From f6210866f148cb2b93f88dad01243f87ac154f1d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 19:39:17 +0000 Subject: [PATCH 1/8] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0e0b9636..32fc9a55 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 86 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 535b6e5f26a295d609b259c8cb8f656c +config_hash: 3b590818075ca4b54949578b97494525 From 55ae767021a1d03a2c8bc4184163acd56ee64d41 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 28 May 2025 20:49:50 +0000 Subject: [PATCH 2/8] feat(api): Config update for pakrym-stream-param --- .stats.yml | 6 +- .../models/responses/ResponseOutputText.kt | 594 +++++++++++++++++- .../responses/ResponseRetrieveParams.kt | 28 +- .../services/async/ResponseServiceAsync.kt | 86 +++ .../async/ResponseServiceAsyncImpl.kt | 46 ++ .../services/blocking/ResponseService.kt | 91 +++ .../services/blocking/ResponseServiceImpl.kt | 40 ++ .../responses/ResponseCompletedEventTest.kt | 42 ++ .../ResponseContentPartAddedEventTest.kt | 42 ++ .../ResponseContentPartDoneEventTest.kt | 42 ++ .../models/responses/ResponseContentTest.kt | 28 + .../responses/ResponseCreatedEventTest.kt | 42 ++ .../responses/ResponseFailedEventTest.kt | 42 ++ .../responses/ResponseInProgressEventTest.kt | 42 ++ .../responses/ResponseIncompleteEventTest.kt | 42 ++ .../models/responses/ResponseInputItemTest.kt | 28 + .../models/responses/ResponseItemTest.kt | 28 + .../ResponseOutputItemAddedEventTest.kt | 42 ++ .../ResponseOutputItemDoneEventTest.kt | 42 ++ .../responses/ResponseOutputItemTest.kt | 28 + .../responses/ResponseOutputMessageTest.kt | 42 ++ .../responses/ResponseOutputTextTest.kt | 44 ++ .../responses/ResponseQueuedEventTest.kt | 42 ++ .../responses/ResponseRetrieveParamsTest.kt | 9 +- .../responses/ResponseStreamEventTest.kt | 286 +++++++++ .../openai/models/responses/ResponseTest.kt | 42 ++ .../async/ResponseServiceAsyncTest.kt | 24 + .../services/blocking/ResponseServiceTest.kt | 24 + 28 files changed, 1882 insertions(+), 12 deletions(-) diff --git a/.stats.yml b/.stats.yml index 32fc9a55..f7966268 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 86 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fc64d7c2c8f51f750813375356c3f3fdfc7fc1b1b34f19c20a5410279d445d37.yml -openapi_spec_hash: 618285fc70199ee32b9ebe4bf72f7e4c -config_hash: 3b590818075ca4b54949578b97494525 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml +openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 +config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt index fc110417..261bd1a9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputText.kt @@ -35,6 +35,7 @@ private constructor( private val annotations: JsonField>, private val text: JsonField, private val type: JsonValue, + private val logprobs: JsonField>, private val additionalProperties: MutableMap, ) { @@ -45,7 +46,10 @@ private constructor( annotations: JsonField> = JsonMissing.of(), @JsonProperty("text") @ExcludeMissing text: JsonField = JsonMissing.of(), @JsonProperty("type") @ExcludeMissing type: JsonValue = JsonMissing.of(), - ) : this(annotations, text, type, mutableMapOf()) + @JsonProperty("logprobs") + @ExcludeMissing + logprobs: JsonField> = JsonMissing.of(), + ) : this(annotations, text, type, logprobs, mutableMapOf()) /** * The annotations of the text output. @@ -76,6 +80,12 @@ private constructor( */ @JsonProperty("type") @ExcludeMissing fun _type(): JsonValue = type + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun logprobs(): Optional> = logprobs.getOptional("logprobs") + /** * Returns the raw JSON value of [annotations]. * @@ -92,6 +102,13 @@ private constructor( */ @JsonProperty("text") @ExcludeMissing fun _text(): JsonField = text + /** + * Returns the raw JSON value of [logprobs]. + * + * Unlike [logprobs], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("logprobs") @ExcludeMissing fun _logprobs(): JsonField> = logprobs + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -124,6 +141,7 @@ private constructor( private var annotations: JsonField>? = null private var text: JsonField? = null private var type: JsonValue = JsonValue.from("output_text") + private var logprobs: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -131,6 +149,7 @@ private constructor( annotations = responseOutputText.annotations.map { it.toMutableList() } text = responseOutputText.text type = responseOutputText.type + logprobs = responseOutputText.logprobs.map { it.toMutableList() } additionalProperties = responseOutputText.additionalProperties.toMutableMap() } @@ -197,6 +216,31 @@ private constructor( */ fun type(type: JsonValue) = apply { this.type = type } + fun logprobs(logprobs: List) = logprobs(JsonField.of(logprobs)) + + /** + * Sets [Builder.logprobs] to an arbitrary JSON value. + * + * You should usually call [Builder.logprobs] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun logprobs(logprobs: JsonField>) = apply { + this.logprobs = logprobs.map { it.toMutableList() } + } + + /** + * Adds a single [Logprob] to [logprobs]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLogprob(logprob: Logprob) = apply { + logprobs = + (logprobs ?: JsonField.of(mutableListOf())).also { + checkKnown("logprobs", it).add(logprob) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -234,6 +278,7 @@ private constructor( checkRequired("annotations", annotations).map { it.toImmutable() }, checkRequired("text", text), type, + (logprobs ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -252,6 +297,7 @@ private constructor( throw OpenAIInvalidDataException("'type' is invalid, received $it") } } + logprobs().ifPresent { it.forEach { it.validate() } } validated = true } @@ -272,7 +318,8 @@ private constructor( internal fun validity(): Int = (annotations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (if (text.asKnown().isPresent) 1 else 0) + - type.let { if (it == JsonValue.from("output_text")) 1 else 0 } + type.let { if (it == JsonValue.from("output_text")) 1 else 0 } + + (logprobs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) /** A citation to a file. */ @JsonDeserialize(using = Annotation.Deserializer::class) @@ -1287,20 +1334,557 @@ private constructor( } } + /** The log probability of a token. */ + class Logprob + private constructor( + private val token: JsonField, + private val bytes: JsonField>, + private val logprob: JsonField, + private val topLogprobs: JsonField>, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("bytes") @ExcludeMissing bytes: JsonField> = JsonMissing.of(), + @JsonProperty("logprob") @ExcludeMissing logprob: JsonField = JsonMissing.of(), + @JsonProperty("top_logprobs") + @ExcludeMissing + topLogprobs: JsonField> = JsonMissing.of(), + ) : this(token, bytes, logprob, topLogprobs, mutableMapOf()) + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun token(): String = token.getRequired("token") + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun bytes(): List = bytes.getRequired("bytes") + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun logprob(): Double = logprob.getRequired("logprob") + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected value). + */ + fun topLogprobs(): List = topLogprobs.getRequired("top_logprobs") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [bytes]. + * + * Unlike [bytes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("bytes") @ExcludeMissing fun _bytes(): JsonField> = bytes + + /** + * Returns the raw JSON value of [logprob]. + * + * Unlike [logprob], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("logprob") @ExcludeMissing fun _logprob(): JsonField = logprob + + /** + * Returns the raw JSON value of [topLogprobs]. + * + * Unlike [topLogprobs], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("top_logprobs") + @ExcludeMissing + fun _topLogprobs(): JsonField> = topLogprobs + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [Logprob]. + * + * The following fields are required: + * ```java + * .token() + * .bytes() + * .logprob() + * .topLogprobs() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Logprob]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var bytes: JsonField>? = null + private var logprob: JsonField? = null + private var topLogprobs: JsonField>? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(logprob: Logprob) = apply { + token = logprob.token + bytes = logprob.bytes.map { it.toMutableList() } + this.logprob = logprob.logprob + topLogprobs = logprob.topLogprobs.map { it.toMutableList() } + additionalProperties = logprob.additionalProperties.toMutableMap() + } + + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + fun bytes(bytes: List) = bytes(JsonField.of(bytes)) + + /** + * Sets [Builder.bytes] to an arbitrary JSON value. + * + * You should usually call [Builder.bytes] with a well-typed `List` value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun bytes(bytes: JsonField>) = apply { + this.bytes = bytes.map { it.toMutableList() } + } + + /** + * Adds a single [Long] to [bytes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addByte(byte_: Long) = apply { + bytes = + (bytes ?: JsonField.of(mutableListOf())).also { + checkKnown("bytes", it).add(byte_) + } + } + + fun logprob(logprob: Double) = logprob(JsonField.of(logprob)) + + /** + * Sets [Builder.logprob] to an arbitrary JSON value. + * + * You should usually call [Builder.logprob] with a well-typed [Double] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun logprob(logprob: JsonField) = apply { this.logprob = logprob } + + fun topLogprobs(topLogprobs: List) = topLogprobs(JsonField.of(topLogprobs)) + + /** + * Sets [Builder.topLogprobs] to an arbitrary JSON value. + * + * You should usually call [Builder.topLogprobs] with a well-typed `List` + * value instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun topLogprobs(topLogprobs: JsonField>) = apply { + this.topLogprobs = topLogprobs.map { it.toMutableList() } + } + + /** + * Adds a single [TopLogprob] to [topLogprobs]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addTopLogprob(topLogprob: TopLogprob) = apply { + topLogprobs = + (topLogprobs ?: JsonField.of(mutableListOf())).also { + checkKnown("topLogprobs", it).add(topLogprob) + } + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Logprob]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .bytes() + * .logprob() + * .topLogprobs() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): Logprob = + Logprob( + checkRequired("token", token), + checkRequired("bytes", bytes).map { it.toImmutable() }, + checkRequired("logprob", logprob), + checkRequired("topLogprobs", topLogprobs).map { it.toImmutable() }, + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): Logprob = apply { + if (validated) { + return@apply + } + + token() + bytes() + logprob() + topLogprobs().forEach { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (bytes.asKnown().getOrNull()?.size ?: 0) + + (if (logprob.asKnown().isPresent) 1 else 0) + + (topLogprobs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** The top log probability of a token. */ + class TopLogprob + private constructor( + private val token: JsonField, + private val bytes: JsonField>, + private val logprob: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("token") @ExcludeMissing token: JsonField = JsonMissing.of(), + @JsonProperty("bytes") + @ExcludeMissing + bytes: JsonField> = JsonMissing.of(), + @JsonProperty("logprob") + @ExcludeMissing + logprob: JsonField = JsonMissing.of(), + ) : this(token, bytes, logprob, mutableMapOf()) + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun token(): String = token.getRequired("token") + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun bytes(): List = bytes.getRequired("bytes") + + /** + * @throws OpenAIInvalidDataException if the JSON field has an unexpected type or is + * unexpectedly missing or null (e.g. if the server responded with an unexpected + * value). + */ + fun logprob(): Double = logprob.getRequired("logprob") + + /** + * Returns the raw JSON value of [token]. + * + * Unlike [token], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("token") @ExcludeMissing fun _token(): JsonField = token + + /** + * Returns the raw JSON value of [bytes]. + * + * Unlike [bytes], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("bytes") @ExcludeMissing fun _bytes(): JsonField> = bytes + + /** + * Returns the raw JSON value of [logprob]. + * + * Unlike [logprob], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("logprob") @ExcludeMissing fun _logprob(): JsonField = logprob + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [TopLogprob]. + * + * The following fields are required: + * ```java + * .token() + * .bytes() + * .logprob() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [TopLogprob]. */ + class Builder internal constructor() { + + private var token: JsonField? = null + private var bytes: JsonField>? = null + private var logprob: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(topLogprob: TopLogprob) = apply { + token = topLogprob.token + bytes = topLogprob.bytes.map { it.toMutableList() } + logprob = topLogprob.logprob + additionalProperties = topLogprob.additionalProperties.toMutableMap() + } + + fun token(token: String) = token(JsonField.of(token)) + + /** + * Sets [Builder.token] to an arbitrary JSON value. + * + * You should usually call [Builder.token] with a well-typed [String] value instead. + * This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun token(token: JsonField) = apply { this.token = token } + + fun bytes(bytes: List) = bytes(JsonField.of(bytes)) + + /** + * Sets [Builder.bytes] to an arbitrary JSON value. + * + * You should usually call [Builder.bytes] with a well-typed `List` value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun bytes(bytes: JsonField>) = apply { + this.bytes = bytes.map { it.toMutableList() } + } + + /** + * Adds a single [Long] to [bytes]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addByte(byte_: Long) = apply { + bytes = + (bytes ?: JsonField.of(mutableListOf())).also { + checkKnown("bytes", it).add(byte_) + } + } + + fun logprob(logprob: Double) = logprob(JsonField.of(logprob)) + + /** + * Sets [Builder.logprob] to an arbitrary JSON value. + * + * You should usually call [Builder.logprob] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun logprob(logprob: JsonField) = apply { this.logprob = logprob } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [TopLogprob]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .token() + * .bytes() + * .logprob() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): TopLogprob = + TopLogprob( + checkRequired("token", token), + checkRequired("bytes", bytes).map { it.toImmutable() }, + checkRequired("logprob", logprob), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + fun validate(): TopLogprob = apply { + if (validated) { + return@apply + } + + token() + bytes() + logprob() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: OpenAIInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (token.asKnown().isPresent) 1 else 0) + + (bytes.asKnown().getOrNull()?.size ?: 0) + + (if (logprob.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is TopLogprob && token == other.token && bytes == other.bytes && logprob == other.logprob && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(token, bytes, logprob, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "TopLogprob{token=$token, bytes=$bytes, logprob=$logprob, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is Logprob && token == other.token && bytes == other.bytes && logprob == other.logprob && topLogprobs == other.topLogprobs && additionalProperties == other.additionalProperties /* spotless:on */ + } + + /* spotless:off */ + private val hashCode: Int by lazy { Objects.hash(token, bytes, logprob, topLogprobs, additionalProperties) } + /* spotless:on */ + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Logprob{token=$token, bytes=$bytes, logprob=$logprob, topLogprobs=$topLogprobs, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true } - return /* spotless:off */ other is ResponseOutputText && annotations == other.annotations && text == other.text && type == other.type && additionalProperties == other.additionalProperties /* spotless:on */ + return /* spotless:off */ other is ResponseOutputText && annotations == other.annotations && text == other.text && type == other.type && logprobs == other.logprobs && additionalProperties == other.additionalProperties /* spotless:on */ } /* spotless:off */ - private val hashCode: Int by lazy { Objects.hash(annotations, text, type, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(annotations, text, type, logprobs, additionalProperties) } /* spotless:on */ override fun hashCode(): Int = hashCode override fun toString() = - "ResponseOutputText{annotations=$annotations, text=$text, type=$type, additionalProperties=$additionalProperties}" + "ResponseOutputText{annotations=$annotations, text=$text, type=$type, logprobs=$logprobs, additionalProperties=$additionalProperties}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt index bc158949..41d9d860 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt @@ -15,6 +15,7 @@ class ResponseRetrieveParams private constructor( private val responseId: String?, private val include: List?, + private val startingAfter: Long?, private val additionalHeaders: Headers, private val additionalQueryParams: QueryParams, ) : Params { @@ -27,6 +28,9 @@ private constructor( */ fun include(): Optional> = Optional.ofNullable(include) + /** The sequence number of the event after which to start streaming. */ + fun startingAfter(): Optional = Optional.ofNullable(startingAfter) + fun _additionalHeaders(): Headers = additionalHeaders fun _additionalQueryParams(): QueryParams = additionalQueryParams @@ -46,6 +50,7 @@ private constructor( private var responseId: String? = null private var include: MutableList? = null + private var startingAfter: Long? = null private var additionalHeaders: Headers.Builder = Headers.builder() private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() @@ -53,6 +58,7 @@ private constructor( internal fun from(responseRetrieveParams: ResponseRetrieveParams) = apply { responseId = responseRetrieveParams.responseId include = responseRetrieveParams.include?.toMutableList() + startingAfter = responseRetrieveParams.startingAfter additionalHeaders = responseRetrieveParams.additionalHeaders.toBuilder() additionalQueryParams = responseRetrieveParams.additionalQueryParams.toBuilder() } @@ -82,6 +88,19 @@ private constructor( this.include = (this.include ?: mutableListOf()).apply { add(include) } } + /** The sequence number of the event after which to start streaming. */ + fun startingAfter(startingAfter: Long?) = apply { this.startingAfter = startingAfter } + + /** + * Alias for [Builder.startingAfter]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun startingAfter(startingAfter: Long) = startingAfter(startingAfter as Long?) + + /** Alias for calling [Builder.startingAfter] with `startingAfter.orElse(null)`. */ + fun startingAfter(startingAfter: Optional) = startingAfter(startingAfter.getOrNull()) + fun additionalHeaders(additionalHeaders: Headers) = apply { this.additionalHeaders.clear() putAllAdditionalHeaders(additionalHeaders) @@ -189,6 +208,7 @@ private constructor( ResponseRetrieveParams( responseId, include?.toImmutable(), + startingAfter, additionalHeaders.build(), additionalQueryParams.build(), ) @@ -206,6 +226,8 @@ private constructor( QueryParams.builder() .apply { include?.forEach { put("include[]", it.toString()) } + startingAfter?.let { put("starting_after", it.toString()) } + stream?.let { put("stream", it.toString()) } putAll(additionalQueryParams) } .build() @@ -215,11 +237,11 @@ private constructor( return true } - return /* spotless:off */ other is ResponseRetrieveParams && responseId == other.responseId && include == other.include && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ + return /* spotless:off */ other is ResponseRetrieveParams && responseId == other.responseId && include == other.include && startingAfter == other.startingAfter && additionalHeaders == other.additionalHeaders && additionalQueryParams == other.additionalQueryParams /* spotless:on */ } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(responseId, include, additionalHeaders, additionalQueryParams) /* spotless:on */ + override fun hashCode(): Int = /* spotless:off */ Objects.hash(responseId, include, startingAfter, additionalHeaders, additionalQueryParams) /* spotless:on */ override fun toString() = - "ResponseRetrieveParams{responseId=$responseId, include=$include, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" + "ResponseRetrieveParams{responseId=$responseId, include=$include, startingAfter=$startingAfter, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt index f7a4a281..a7404439 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt @@ -98,6 +98,43 @@ interface ResponseServiceAsync { fun retrieve(responseId: String, requestOptions: RequestOptions): CompletableFuture = retrieve(responseId, ResponseRetrieveParams.none(), requestOptions) + /** Retrieves a model response with the given ID. */ + fun retrieveStreaming(responseId: String): AsyncStreamResponse = + retrieveStreaming(responseId, ResponseRetrieveParams.none()) + + /** @see [retrieveStreaming] */ + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): AsyncStreamResponse = + retrieveStreaming(params.toBuilder().responseId(responseId).build(), requestOptions) + + /** @see [retrieveStreaming] */ + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + ): AsyncStreamResponse = + retrieveStreaming(responseId, params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): AsyncStreamResponse + + /** @see [retrieveStreaming] */ + fun retrieveStreaming( + params: ResponseRetrieveParams + ): AsyncStreamResponse = retrieveStreaming(params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + fun retrieveStreaming( + responseId: String, + requestOptions: RequestOptions, + ): AsyncStreamResponse = + retrieveStreaming(responseId, ResponseRetrieveParams.none(), requestOptions) + /** Deletes a model response with the given ID. */ fun delete(responseId: String): CompletableFuture = delete(responseId, ResponseDeleteParams.none()) @@ -250,6 +287,55 @@ interface ResponseServiceAsync { ): CompletableFuture> = retrieve(responseId, ResponseRetrieveParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /responses/{response_id}`, but is otherwise the same + * as [ResponseServiceAsync.retrieveStreaming]. + */ + @MustBeClosed + fun retrieveStreaming( + responseId: String + ): CompletableFuture>> = + retrieveStreaming(responseId, ResponseRetrieveParams.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> = + retrieveStreaming(params.toBuilder().responseId(responseId).build(), requestOptions) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + ): CompletableFuture>> = + retrieveStreaming(responseId, params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): CompletableFuture>> + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + params: ResponseRetrieveParams + ): CompletableFuture>> = + retrieveStreaming(params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + requestOptions: RequestOptions, + ): CompletableFuture>> = + retrieveStreaming(responseId, ResponseRetrieveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `delete /responses/{response_id}`, but is otherwise the * same as [ResponseServiceAsync.delete]. diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt index e767ed3f..a1a56044 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt @@ -75,6 +75,16 @@ class ResponseServiceAsyncImpl internal constructor(private val clientOptions: C // get /responses/{response_id} withRawResponse().retrieve(params, requestOptions).thenApply { it.parse() } + override fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions, + ): AsyncStreamResponse = + // get /responses/{response_id} + withRawResponse() + .retrieveStreaming(params, requestOptions) + .thenApply { it.parse() } + .toAsync(clientOptions.streamHandlerExecutor) + override fun delete( params: ResponseDeleteParams, requestOptions: RequestOptions, @@ -205,6 +215,42 @@ class ResponseServiceAsyncImpl internal constructor(private val clientOptions: C } } + private val retrieveStreamingHandler: Handler> = + sseHandler(clientOptions.jsonMapper) + .mapJson() + .withErrorHandler(errorHandler) + + override fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions, + ): CompletableFuture>> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("responseId", params.responseId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("responses", params._pathParam(0)) + .build() + .prepareAsync(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + return request + .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } + .thenApply { response -> + response.parseable { + response + .let { retrieveStreamingHandler.handle(it) } + .let { streamResponse -> + if (requestOptions.responseValidation!!) { + streamResponse.map { it.validate() } + } else { + streamResponse + } + } + } + } + } + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) override fun delete( diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt index 68a94a64..bee98ec6 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseService.kt @@ -117,6 +117,48 @@ interface ResponseService { fun retrieve(responseId: String, requestOptions: RequestOptions): Response = retrieve(responseId, ResponseRetrieveParams.none(), requestOptions) + /** Retrieves a model response with the given ID. */ + @MustBeClosed + fun retrieveStreaming(responseId: String): StreamResponse = + retrieveStreaming(responseId, ResponseRetrieveParams.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): StreamResponse = + retrieveStreaming(params.toBuilder().responseId(responseId).build(), requestOptions) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + ): StreamResponse = + retrieveStreaming(responseId, params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): StreamResponse + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming(params: ResponseRetrieveParams): StreamResponse = + retrieveStreaming(params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + requestOptions: RequestOptions, + ): StreamResponse = + retrieveStreaming(responseId, ResponseRetrieveParams.none(), requestOptions) + /** Deletes a model response with the given ID. */ fun delete(responseId: String) = delete(responseId, ResponseDeleteParams.none()) @@ -250,6 +292,55 @@ interface ResponseService { ): HttpResponseFor = retrieve(responseId, ResponseRetrieveParams.none(), requestOptions) + /** + * Returns a raw HTTP response for `get /responses/{response_id}`, but is otherwise the same + * as [ResponseService.retrieveStreaming]. + */ + @MustBeClosed + fun retrieveStreaming( + responseId: String + ): HttpResponseFor> = + retrieveStreaming(responseId, ResponseRetrieveParams.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> = + retrieveStreaming(params.toBuilder().responseId(responseId).build(), requestOptions) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + params: ResponseRetrieveParams = ResponseRetrieveParams.none(), + ): HttpResponseFor> = + retrieveStreaming(responseId, params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions = RequestOptions.none(), + ): HttpResponseFor> + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + params: ResponseRetrieveParams + ): HttpResponseFor> = + retrieveStreaming(params, RequestOptions.none()) + + /** @see [retrieveStreaming] */ + @MustBeClosed + fun retrieveStreaming( + responseId: String, + requestOptions: RequestOptions, + ): HttpResponseFor> = + retrieveStreaming(responseId, ResponseRetrieveParams.none(), requestOptions) + /** * Returns a raw HTTP response for `delete /responses/{response_id}`, but is otherwise the * same as [ResponseService.delete]. diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt index e6e02207..ec524da8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt @@ -64,6 +64,13 @@ class ResponseServiceImpl internal constructor(private val clientOptions: Client // get /responses/{response_id} withRawResponse().retrieve(params, requestOptions).parse() + override fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions, + ): StreamResponse = + // get /responses/{response_id} + withRawResponse().retrieveStreaming(params, requestOptions).parse() + override fun delete(params: ResponseDeleteParams, requestOptions: RequestOptions) { // delete /responses/{response_id} withRawResponse().delete(params, requestOptions) @@ -181,6 +188,39 @@ class ResponseServiceImpl internal constructor(private val clientOptions: Client } } + private val retrieveStreamingHandler: Handler> = + sseHandler(clientOptions.jsonMapper) + .mapJson() + .withErrorHandler(errorHandler) + + override fun retrieveStreaming( + params: ResponseRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponseFor> { + // We check here instead of in the params builder because this can be specified + // positionally or in the params class. + checkRequired("responseId", params.responseId().getOrNull()) + val request = + HttpRequest.builder() + .method(HttpMethod.GET) + .addPathSegments("responses", params._pathParam(0)) + .build() + .prepare(clientOptions, params) + val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) + val response = clientOptions.httpClient.execute(request, requestOptions) + return response.parseable { + response + .let { retrieveStreamingHandler.handle(it) } + .let { streamResponse -> + if (requestOptions.responseValidation!!) { + streamResponse.map { it.validate() } + } else { + streamResponse + } + } + } + } + private val deleteHandler: Handler = emptyHandler().withErrorHandler(errorHandler) override fun delete( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCompletedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCompletedEventTest.kt index a85f3263..4519aeb3 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCompletedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCompletedEventTest.kt @@ -52,6 +52,20 @@ internal class ResponseCompletedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -149,6 +163,20 @@ internal class ResponseCompletedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -248,6 +276,20 @@ internal class ResponseCompletedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartAddedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartAddedEventTest.kt index 4bb41e5c..5026a2d8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartAddedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartAddedEventTest.kt @@ -25,6 +25,20 @@ internal class ResponseContentPartAddedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) @@ -44,6 +58,20 @@ internal class ResponseContentPartAddedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) ) @@ -67,6 +95,20 @@ internal class ResponseContentPartAddedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartDoneEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartDoneEventTest.kt index 4c9aff60..88882527 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartDoneEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentPartDoneEventTest.kt @@ -25,6 +25,20 @@ internal class ResponseContentPartDoneEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) @@ -44,6 +58,20 @@ internal class ResponseContentPartDoneEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) ) @@ -67,6 +95,20 @@ internal class ResponseContentPartDoneEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt index e8792529..1ddc2005 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseContentTest.kt @@ -131,6 +131,20 @@ internal class ResponseContentTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() val responseContent = ResponseContent.ofOutputText(outputText) @@ -155,6 +169,20 @@ internal class ResponseContentTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreatedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreatedEventTest.kt index ba603cf9..c34e582b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreatedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseCreatedEventTest.kt @@ -52,6 +52,20 @@ internal class ResponseCreatedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -149,6 +163,20 @@ internal class ResponseCreatedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -248,6 +276,20 @@ internal class ResponseCreatedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFailedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFailedEventTest.kt index e791aaf0..a3a214e3 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFailedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseFailedEventTest.kt @@ -52,6 +52,20 @@ internal class ResponseFailedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -149,6 +163,20 @@ internal class ResponseFailedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -248,6 +276,20 @@ internal class ResponseFailedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInProgressEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInProgressEventTest.kt index 23bbbc13..1bad676d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInProgressEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInProgressEventTest.kt @@ -52,6 +52,20 @@ internal class ResponseInProgressEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -149,6 +163,20 @@ internal class ResponseInProgressEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -248,6 +276,20 @@ internal class ResponseInProgressEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseIncompleteEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseIncompleteEventTest.kt index afa0d044..6562d382 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseIncompleteEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseIncompleteEventTest.kt @@ -52,6 +52,20 @@ internal class ResponseIncompleteEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -149,6 +163,20 @@ internal class ResponseIncompleteEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -248,6 +276,20 @@ internal class ResponseIncompleteEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt index cdf707f9..8de277d1 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseInputItemTest.kt @@ -136,6 +136,20 @@ internal class ResponseInputItemTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -180,6 +194,20 @@ internal class ResponseInputItemTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt index bbca5081..e0fb9cf7 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseItemTest.kt @@ -82,6 +82,20 @@ internal class ResponseItemTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -123,6 +137,20 @@ internal class ResponseItemTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemAddedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemAddedEventTest.kt index 0300c6aa..4f020325 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemAddedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemAddedEventTest.kt @@ -25,6 +25,20 @@ internal class ResponseOutputItemAddedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -48,6 +62,20 @@ internal class ResponseOutputItemAddedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -75,6 +103,20 @@ internal class ResponseOutputItemAddedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemDoneEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemDoneEventTest.kt index e063751e..7008b6c5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemDoneEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemDoneEventTest.kt @@ -25,6 +25,20 @@ internal class ResponseOutputItemDoneEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -48,6 +62,20 @@ internal class ResponseOutputItemDoneEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -75,6 +103,20 @@ internal class ResponseOutputItemDoneEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt index 377d4a56..2bc392d8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputItemTest.kt @@ -28,6 +28,20 @@ internal class ResponseOutputItemTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -65,6 +79,20 @@ internal class ResponseOutputItemTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputMessageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputMessageTest.kt index 5f16b5e0..4595cded 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputMessageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputMessageTest.kt @@ -23,6 +23,20 @@ internal class ResponseOutputMessageTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -40,6 +54,20 @@ internal class ResponseOutputMessageTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) ) @@ -62,6 +90,20 @@ internal class ResponseOutputMessageTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputTextTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputTextTest.kt index 977ea331..239f92f1 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputTextTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseOutputTextTest.kt @@ -4,6 +4,7 @@ package com.openai.models.responses import com.fasterxml.jackson.module.kotlin.jacksonTypeRef import com.openai.core.jsonMapper +import kotlin.jvm.optionals.getOrNull import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @@ -20,6 +21,20 @@ internal class ResponseOutputTextTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() assertThat(responseOutputText.annotations()) @@ -32,6 +47,21 @@ internal class ResponseOutputTextTest { ) ) assertThat(responseOutputText.text()).isEqualTo("text") + assertThat(responseOutputText.logprobs().getOrNull()) + .containsExactly( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) } @Test @@ -46,6 +76,20 @@ internal class ResponseOutputTextTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() val roundtrippedResponseOutputText = diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseQueuedEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseQueuedEventTest.kt index 88f8222f..416cc1db 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseQueuedEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseQueuedEventTest.kt @@ -52,6 +52,20 @@ internal class ResponseQueuedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -149,6 +163,20 @@ internal class ResponseQueuedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -248,6 +276,20 @@ internal class ResponseQueuedEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseRetrieveParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseRetrieveParamsTest.kt index 12626e9d..869b6a1e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseRetrieveParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseRetrieveParamsTest.kt @@ -13,6 +13,7 @@ internal class ResponseRetrieveParamsTest { ResponseRetrieveParams.builder() .responseId("resp_677efb5139a88190b512bc3fef8e535d") .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) + .startingAfter(0L) .build() } @@ -34,12 +35,18 @@ internal class ResponseRetrieveParamsTest { ResponseRetrieveParams.builder() .responseId("resp_677efb5139a88190b512bc3fef8e535d") .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) + .startingAfter(0L) .build() val queryParams = params._queryParams() assertThat(queryParams) - .isEqualTo(QueryParams.builder().put("include[]", "file_search_call.results").build()) + .isEqualTo( + QueryParams.builder() + .put("include[]", "file_search_call.results") + .put("starting_after", "0") + .build() + ) } @Test diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseStreamEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseStreamEventTest.kt index 6bc71178..f8af2a3f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseStreamEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseStreamEventTest.kt @@ -866,6 +866,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -1025,6 +1039,21 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob + .builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -1113,6 +1142,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) @@ -1193,6 +1236,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) @@ -1224,6 +1281,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) @@ -1304,6 +1375,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .sequenceNumber(0L) @@ -1357,6 +1442,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -1516,6 +1615,21 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob + .builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2162,6 +2276,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2321,6 +2449,21 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob + .builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2431,6 +2574,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2590,6 +2747,21 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob + .builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2700,6 +2872,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2859,6 +3045,21 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob + .builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -2947,6 +3148,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -3031,6 +3246,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -3066,6 +3295,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -3150,6 +3393,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -5323,6 +5580,20 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -5482,6 +5753,21 @@ internal class ResponseStreamEventTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob + .builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseTest.kt index d54057d3..04aadfe3 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/responses/ResponseTest.kt @@ -51,6 +51,20 @@ internal class ResponseTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -143,6 +157,20 @@ internal class ResponseTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) @@ -241,6 +269,20 @@ internal class ResponseTest { .build() ) .text("text") + .addLogprob( + ResponseOutputText.Logprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ResponseOutputText.Logprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() + ) .build() ) .status(ResponseOutputMessage.Status.IN_PROGRESS) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt index a77848b8..80da0a9b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/ResponseServiceAsyncTest.kt @@ -162,6 +162,7 @@ internal class ResponseServiceAsyncTest { ResponseRetrieveParams.builder() .responseId("resp_677efb5139a88190b512bc3fef8e535d") .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) + .startingAfter(0L) .build() ) @@ -169,6 +170,29 @@ internal class ResponseServiceAsyncTest { response.validate() } + @Test + fun retrieveStreaming() { + val client = + OpenAIOkHttpClientAsync.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val responseServiceAsync = client.responses() + + val responseStreamResponse = + responseServiceAsync.retrieveStreaming( + ResponseRetrieveParams.builder() + .responseId("resp_677efb5139a88190b512bc3fef8e535d") + .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) + .startingAfter(0L) + .build() + ) + + val onCompleteFuture = + responseStreamResponse.subscribe { response -> response.validate() }.onCompleteFuture() + onCompleteFuture.get() + } + @Test fun delete() { val client = diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt index a27a4a9d..aeccdff4 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/ResponseServiceTest.kt @@ -161,12 +161,36 @@ internal class ResponseServiceTest { ResponseRetrieveParams.builder() .responseId("resp_677efb5139a88190b512bc3fef8e535d") .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) + .startingAfter(0L) .build() ) response.validate() } + @Test + fun retrieveStreaming() { + val client = + OpenAIOkHttpClient.builder() + .baseUrl(TestServerExtension.BASE_URL) + .apiKey("My API Key") + .build() + val responseService = client.responses() + + val responseStreamResponse = + responseService.retrieveStreaming( + ResponseRetrieveParams.builder() + .responseId("resp_677efb5139a88190b512bc3fef8e535d") + .addInclude(ResponseIncludable.FILE_SEARCH_CALL_RESULTS) + .startingAfter(0L) + .build() + ) + + responseStreamResponse.use { + responseStreamResponse.stream().forEach { response -> response.validate() } + } + } + @Test fun delete() { val client = From 37aa563789f34de917758519d859f17d9c1a98fc Mon Sep 17 00:00:00 2001 From: Max Murin Date: Wed, 28 May 2025 20:43:42 -0400 Subject: [PATCH 3/8] fix(client): add missing deployment model param (#704) --- .../com/openai/services/async/ResponseServiceAsyncImpl.kt | 2 +- .../kotlin/com/openai/services/blocking/ResponseServiceImpl.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt index a1a56044..9bbaf4f3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt @@ -232,7 +232,7 @@ class ResponseServiceAsyncImpl internal constructor(private val clientOptions: C .method(HttpMethod.GET) .addPathSegments("responses", params._pathParam(0)) .build() - .prepareAsync(clientOptions, params) + .prepareAsync(clientOptions, params, deploymentModel = null) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt index ec524da8..5f7c775a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt @@ -205,7 +205,7 @@ class ResponseServiceImpl internal constructor(private val clientOptions: Client .method(HttpMethod.GET) .addPathSegments("responses", params._pathParam(0)) .build() - .prepare(clientOptions, params) + .prepare(clientOptions, params, deploymentModel = null) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response.parseable { From 787e12b4ac3d33f46aa31c165241c26f927e92dc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 01:56:33 +0000 Subject: [PATCH 4/8] fix(client): return binary content from `get /containers/{container_id}/files/{file_id}/content` --- .stats.yml | 2 +- .../containers/files/ContentServiceAsync.kt | 12 ++++++--- .../files/ContentServiceAsyncImpl.kt | 17 ++++-------- .../containers/files/ContentService.kt | 13 ++++++--- .../containers/files/ContentServiceImpl.kt | 14 ++++------ .../files/ContentServiceAsyncTest.kt | 20 +++++++++++--- .../containers/files/ContentServiceTest.kt | 27 +++++++++++++++---- 7 files changed, 66 insertions(+), 39 deletions(-) diff --git a/.stats.yml b/.stats.yml index f7966268..9aad2898 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 86 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d4bcffecf0cdadf746faa6708ed1ec81fac451f9b857deabbab26f0a343b9314.yml openapi_spec_hash: 7c54a18b4381248bda7cc34c52142615 -config_hash: 2102e4b25bbcab5d32d5ffa5d34daa0c +config_hash: d23f847b9ebb3f427d0f198035bd3e9f diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt index de08b7c7..9ece51d3 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt @@ -16,26 +16,30 @@ interface ContentServiceAsync { fun withRawResponse(): WithRawResponse /** Retrieve Container File Content */ - fun retrieve(fileId: String, params: ContentRetrieveParams): CompletableFuture = + @MustBeClosed + fun retrieve(fileId: String, params: ContentRetrieveParams): CompletableFuture = retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ + @MustBeClosed fun retrieve( fileId: String, params: ContentRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = + ): CompletableFuture = retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - fun retrieve(params: ContentRetrieveParams): CompletableFuture = + @MustBeClosed + fun retrieve(params: ContentRetrieveParams): CompletableFuture = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ + @MustBeClosed fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture + ): CompletableFuture /** * A view of [ContentServiceAsync] that provides access to raw HTTP responses for each method. diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncImpl.kt index 15c9bb3b..7bb51987 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncImpl.kt @@ -5,14 +5,11 @@ package com.openai.services.async.containers.files import com.openai.core.ClientOptions import com.openai.core.RequestOptions import com.openai.core.checkRequired -import com.openai.core.handlers.emptyHandler import com.openai.core.handlers.errorHandler -import com.openai.core.handlers.withErrorHandler import com.openai.core.http.HttpMethod import com.openai.core.http.HttpRequest import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponse.Handler -import com.openai.core.http.parseable import com.openai.core.prepareAsync import com.openai.models.ErrorObject import com.openai.models.containers.files.content.ContentRetrieveParams @@ -31,17 +28,15 @@ class ContentServiceAsyncImpl internal constructor(private val clientOptions: Cl override fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions, - ): CompletableFuture = + ): CompletableFuture = // get /containers/{container_id}/files/{file_id}/content - withRawResponse().retrieve(params, requestOptions).thenAccept {} + withRawResponse().retrieve(params, requestOptions) class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ContentServiceAsync.WithRawResponse { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val retrieveHandler: Handler = emptyHandler().withErrorHandler(errorHandler) - override fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions, @@ -62,11 +57,9 @@ class ContentServiceAsyncImpl internal constructor(private val clientOptions: Cl .build() .prepareAsync(clientOptions, params, deploymentModel = null) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - response.parseable { response.use { retrieveHandler.handle(it) } } - } + return request.thenComposeAsync { + clientOptions.httpClient.executeAsync(it, requestOptions) + } } } } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentService.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentService.kt index deca974f..ba508497 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentService.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentService.kt @@ -15,24 +15,29 @@ interface ContentService { fun withRawResponse(): WithRawResponse /** Retrieve Container File Content */ - fun retrieve(fileId: String, params: ContentRetrieveParams) = + @MustBeClosed + fun retrieve(fileId: String, params: ContentRetrieveParams): HttpResponse = retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ + @MustBeClosed fun retrieve( fileId: String, params: ContentRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ) = retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) + ): HttpResponse = retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - fun retrieve(params: ContentRetrieveParams) = retrieve(params, RequestOptions.none()) + @MustBeClosed + fun retrieve(params: ContentRetrieveParams): HttpResponse = + retrieve(params, RequestOptions.none()) /** @see [retrieve] */ + @MustBeClosed fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), - ) + ): HttpResponse /** A view of [ContentService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentServiceImpl.kt index e055903b..8d2280c8 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentServiceImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/containers/files/ContentServiceImpl.kt @@ -5,14 +5,11 @@ package com.openai.services.blocking.containers.files import com.openai.core.ClientOptions import com.openai.core.RequestOptions import com.openai.core.checkRequired -import com.openai.core.handlers.emptyHandler import com.openai.core.handlers.errorHandler -import com.openai.core.handlers.withErrorHandler import com.openai.core.http.HttpMethod import com.openai.core.http.HttpRequest import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponse.Handler -import com.openai.core.http.parseable import com.openai.core.prepare import com.openai.models.ErrorObject import com.openai.models.containers.files.content.ContentRetrieveParams @@ -27,18 +24,18 @@ class ContentServiceImpl internal constructor(private val clientOptions: ClientO override fun withRawResponse(): ContentService.WithRawResponse = withRawResponse - override fun retrieve(params: ContentRetrieveParams, requestOptions: RequestOptions) { + override fun retrieve( + params: ContentRetrieveParams, + requestOptions: RequestOptions, + ): HttpResponse = // get /containers/{container_id}/files/{file_id}/content withRawResponse().retrieve(params, requestOptions) - } class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : ContentService.WithRawResponse { private val errorHandler: Handler = errorHandler(clientOptions.jsonMapper) - private val retrieveHandler: Handler = emptyHandler().withErrorHandler(errorHandler) - override fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions, @@ -59,8 +56,7 @@ class ContentServiceImpl internal constructor(private val clientOptions: ClientO .build() .prepare(clientOptions, params, deploymentModel = null) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return response.parseable { response.use { retrieveHandler.handle(it) } } + return clientOptions.httpClient.execute(request, requestOptions) } } } diff --git a/openai-java-core/src/test/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncTest.kt index 9ed5162c..1f53bd83 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/async/containers/files/ContentServiceAsyncTest.kt @@ -2,25 +2,36 @@ package com.openai.services.async.containers.files +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl +import com.github.tomakehurst.wiremock.client.WireMock.get +import com.github.tomakehurst.wiremock.client.WireMock.ok +import com.github.tomakehurst.wiremock.client.WireMock.stubFor +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.openai.TestServerExtension import com.openai.client.okhttp.OpenAIOkHttpClientAsync import com.openai.models.containers.files.content.ContentRetrieveParams +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.parallel.ResourceLock @ExtendWith(TestServerExtension::class) +@WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class ContentServiceAsyncTest { @Test - fun retrieve() { + fun retrieve(wmRuntimeInfo: WireMockRuntimeInfo) { val client = OpenAIOkHttpClientAsync.builder() - .baseUrl(TestServerExtension.BASE_URL) + .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") .build() val contentServiceAsync = client.containers().files().content() + stubFor(get(anyUrl()).willReturn(ok().withBody("abc"))) - val future = + val contentFuture = contentServiceAsync.retrieve( ContentRetrieveParams.builder() .containerId("container_id") @@ -28,6 +39,7 @@ internal class ContentServiceAsyncTest { .build() ) - val response = future.get() + val content = contentFuture.get() + assertThat(content.body()).hasContent("abc") } } diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/containers/files/ContentServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/containers/files/ContentServiceTest.kt index 5ceb2811..2ccf7890 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/containers/files/ContentServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/containers/files/ContentServiceTest.kt @@ -2,26 +2,43 @@ package com.openai.services.blocking.containers.files +import com.github.tomakehurst.wiremock.client.WireMock.anyUrl +import com.github.tomakehurst.wiremock.client.WireMock.get +import com.github.tomakehurst.wiremock.client.WireMock.ok +import com.github.tomakehurst.wiremock.client.WireMock.stubFor +import com.github.tomakehurst.wiremock.junit5.WireMockRuntimeInfo +import com.github.tomakehurst.wiremock.junit5.WireMockTest import com.openai.TestServerExtension import com.openai.client.okhttp.OpenAIOkHttpClient import com.openai.models.containers.files.content.ContentRetrieveParams +import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test import org.junit.jupiter.api.extension.ExtendWith +import org.junit.jupiter.api.parallel.ResourceLock @ExtendWith(TestServerExtension::class) +@WireMockTest +@ResourceLock("https://github.com/wiremock/wiremock/issues/169") internal class ContentServiceTest { @Test - fun retrieve() { + fun retrieve(wmRuntimeInfo: WireMockRuntimeInfo) { val client = OpenAIOkHttpClient.builder() - .baseUrl(TestServerExtension.BASE_URL) + .baseUrl(wmRuntimeInfo.httpBaseUrl) .apiKey("My API Key") .build() val contentService = client.containers().files().content() + stubFor(get(anyUrl()).willReturn(ok().withBody("abc"))) - contentService.retrieve( - ContentRetrieveParams.builder().containerId("container_id").fileId("file_id").build() - ) + val content = + contentService.retrieve( + ContentRetrieveParams.builder() + .containerId("container_id") + .fileId("file_id") + .build() + ) + + assertThat(content.body()).hasContent("abc") } } From b27559fa7d1c097ada40da12e55d1def372f5dce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 02:01:52 +0000 Subject: [PATCH 5/8] fix(client): correctly send streaming discriminator param --- .../kotlin/com/openai/models/responses/ResponseRetrieveParams.kt | 1 - .../kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt | 1 + .../kotlin/com/openai/services/blocking/ResponseServiceImpl.kt | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt index 41d9d860..9953401d 100644 --- a/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt +++ b/openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseRetrieveParams.kt @@ -227,7 +227,6 @@ private constructor( .apply { include?.forEach { put("include[]", it.toString()) } startingAfter?.let { put("starting_after", it.toString()) } - stream?.let { put("stream", it.toString()) } putAll(additionalQueryParams) } .build() diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt index 9bbaf4f3..1dd9a1f2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsyncImpl.kt @@ -231,6 +231,7 @@ class ResponseServiceAsyncImpl internal constructor(private val clientOptions: C HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("responses", params._pathParam(0)) + .putQueryParam("stream", "true") .build() .prepareAsync(clientOptions, params, deploymentModel = null) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt index 5f7c775a..74aee538 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ResponseServiceImpl.kt @@ -204,6 +204,7 @@ class ResponseServiceImpl internal constructor(private val clientOptions: Client HttpRequest.builder() .method(HttpMethod.GET) .addPathSegments("responses", params._pathParam(0)) + .putQueryParam("stream", "true") .build() .prepare(clientOptions, params, deploymentModel = null) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) From a507f8446a2270ee3e9c5e5295a9a57b59c633eb Mon Sep 17 00:00:00 2001 From: Tomer Aberbach Date: Wed, 28 May 2025 21:57:40 -0400 Subject: [PATCH 6/8] fix(client): optional image deployment model param --- .../com/openai/services/async/ImageServiceAsyncImpl.kt | 6 +++++- .../kotlin/com/openai/services/blocking/ImageServiceImpl.kt | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsyncImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsyncImpl.kt index 744386c3..15108ece 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsyncImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsyncImpl.kt @@ -138,7 +138,11 @@ class ImageServiceAsyncImpl internal constructor(private val clientOptions: Clie .addPathSegments("images", "generations") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepareAsync(clientOptions, params, params.model().toString()) + .prepareAsync( + clientOptions, + params, + deploymentModel = params.model().map { it.toString() }.orElse(null), + ) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) return request .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } diff --git a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ImageServiceImpl.kt b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ImageServiceImpl.kt index d3576add..522844db 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/blocking/ImageServiceImpl.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/blocking/ImageServiceImpl.kt @@ -128,7 +128,11 @@ class ImageServiceImpl internal constructor(private val clientOptions: ClientOpt .addPathSegments("images", "generations") .body(json(clientOptions.jsonMapper, params._body())) .build() - .prepare(clientOptions, params, params.model().toString()) + .prepare( + clientOptions, + params, + params.model().map { it.toString() }.orElse(null), + ) val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) val response = clientOptions.httpClient.execute(request, requestOptions) return response.parseable { From 2988157933dfe2ec7f9f2b626d0fa9eb184db27d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 02:17:17 +0000 Subject: [PATCH 7/8] fix(client): remove `@MustBeClosed` for future returning methods --- .../services/async/BatchServiceAsync.kt | 19 ---------- .../services/async/CompletionServiceAsync.kt | 2 - .../services/async/ContainerServiceAsync.kt | 19 ---------- .../services/async/EmbeddingServiceAsync.kt | 3 -- .../openai/services/async/EvalServiceAsync.kt | 25 ------------- .../openai/services/async/FileServiceAsync.kt | 31 ---------------- .../services/async/ImageServiceAsync.kt | 7 ---- .../services/async/ModelServiceAsync.kt | 17 --------- .../services/async/ModerationServiceAsync.kt | 3 -- .../services/async/ResponseServiceAsync.kt | 20 ---------- .../services/async/UploadServiceAsync.kt | 13 ------- .../services/async/VectorStoreServiceAsync.kt | 31 ---------------- .../async/audio/SpeechServiceAsync.kt | 5 --- .../async/audio/TranscriptionServiceAsync.kt | 2 - .../async/audio/TranslationServiceAsync.kt | 3 -- .../async/chat/ChatCompletionServiceAsync.kt | 22 ----------- .../chat/completions/MessageServiceAsync.kt | 7 ---- .../async/containers/FileServiceAsync.kt | 21 ----------- .../containers/files/ContentServiceAsync.kt | 9 ----- .../services/async/evals/RunServiceAsync.kt | 23 ------------ .../evals/runs/OutputItemServiceAsync.kt | 9 ----- .../async/finetuning/JobServiceAsync.kt | 37 ------------------- .../finetuning/alpha/GraderServiceAsync.kt | 5 --- .../checkpoints/PermissionServiceAsync.kt | 15 -------- .../finetuning/jobs/CheckpointServiceAsync.kt | 7 ---- .../async/responses/InputItemServiceAsync.kt | 7 ---- .../async/uploads/PartServiceAsync.kt | 5 --- .../vectorstores/FileBatchServiceAsync.kt | 17 --------- .../async/vectorstores/FileServiceAsync.kt | 27 -------------- 29 files changed, 411 deletions(-) diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/BatchServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/BatchServiceAsync.kt index 84bc4043..cfe253af 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/BatchServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/BatchServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.batches.Batch @@ -123,12 +122,10 @@ interface BatchServiceAsync { * Returns a raw HTTP response for `post /batches`, but is otherwise the same as * [BatchServiceAsync.create]. */ - @MustBeClosed fun create(params: BatchCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: BatchCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -138,12 +135,10 @@ interface BatchServiceAsync { * Returns a raw HTTP response for `get /batches/{batch_id}`, but is otherwise the same as * [BatchServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(batchId: String): CompletableFuture> = retrieve(batchId, BatchRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( batchId: String, params: BatchRetrieveParams = BatchRetrieveParams.none(), @@ -152,7 +147,6 @@ interface BatchServiceAsync { retrieve(params.toBuilder().batchId(batchId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( batchId: String, params: BatchRetrieveParams = BatchRetrieveParams.none(), @@ -160,19 +154,16 @@ interface BatchServiceAsync { retrieve(batchId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: BatchRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: BatchRetrieveParams): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( batchId: String, requestOptions: RequestOptions, @@ -183,26 +174,22 @@ interface BatchServiceAsync { * Returns a raw HTTP response for `get /batches`, but is otherwise the same as * [BatchServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(BatchListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: BatchListParams = BatchListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: BatchListParams = BatchListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -212,12 +199,10 @@ interface BatchServiceAsync { * Returns a raw HTTP response for `post /batches/{batch_id}/cancel`, but is otherwise the * same as [BatchServiceAsync.cancel]. */ - @MustBeClosed fun cancel(batchId: String): CompletableFuture> = cancel(batchId, BatchCancelParams.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( batchId: String, params: BatchCancelParams = BatchCancelParams.none(), @@ -226,7 +211,6 @@ interface BatchServiceAsync { cancel(params.toBuilder().batchId(batchId).build(), requestOptions) /** @see [cancel] */ - @MustBeClosed fun cancel( batchId: String, params: BatchCancelParams = BatchCancelParams.none(), @@ -234,19 +218,16 @@ interface BatchServiceAsync { cancel(batchId, params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( params: BatchCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [cancel] */ - @MustBeClosed fun cancel(params: BatchCancelParams): CompletableFuture> = cancel(params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( batchId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/CompletionServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/CompletionServiceAsync.kt index a0ba3aa9..30b3eba1 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/CompletionServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/CompletionServiceAsync.kt @@ -48,12 +48,10 @@ interface CompletionServiceAsync { * Returns a raw HTTP response for `post /completions`, but is otherwise the same as * [CompletionServiceAsync.create]. */ - @MustBeClosed fun create(params: CompletionCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: CompletionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ContainerServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ContainerServiceAsync.kt index 3460fb8b..f4ba5ccb 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ContainerServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ContainerServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponseFor @@ -132,14 +131,12 @@ interface ContainerServiceAsync { * Returns a raw HTTP response for `post /containers`, but is otherwise the same as * [ContainerServiceAsync.create]. */ - @MustBeClosed fun create( params: ContainerCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: ContainerCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -149,14 +146,12 @@ interface ContainerServiceAsync { * Returns a raw HTTP response for `get /containers/{container_id}`, but is otherwise the * same as [ContainerServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( containerId: String ): CompletableFuture> = retrieve(containerId, ContainerRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( containerId: String, params: ContainerRetrieveParams = ContainerRetrieveParams.none(), @@ -165,7 +160,6 @@ interface ContainerServiceAsync { retrieve(params.toBuilder().containerId(containerId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( containerId: String, params: ContainerRetrieveParams = ContainerRetrieveParams.none(), @@ -173,21 +167,18 @@ interface ContainerServiceAsync { retrieve(containerId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ContainerRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ContainerRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( containerId: String, requestOptions: RequestOptions, @@ -198,26 +189,22 @@ interface ContainerServiceAsync { * Returns a raw HTTP response for `get /containers`, but is otherwise the same as * [ContainerServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(ContainerListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: ContainerListParams = ContainerListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: ContainerListParams = ContainerListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -227,12 +214,10 @@ interface ContainerServiceAsync { * Returns a raw HTTP response for `delete /containers/{container_id}`, but is otherwise the * same as [ContainerServiceAsync.delete]. */ - @MustBeClosed fun delete(containerId: String): CompletableFuture = delete(containerId, ContainerDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( containerId: String, params: ContainerDeleteParams = ContainerDeleteParams.none(), @@ -241,26 +226,22 @@ interface ContainerServiceAsync { delete(params.toBuilder().containerId(containerId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( containerId: String, params: ContainerDeleteParams = ContainerDeleteParams.none(), ): CompletableFuture = delete(containerId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: ContainerDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see [delete] */ - @MustBeClosed fun delete(params: ContainerDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( containerId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/EmbeddingServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/EmbeddingServiceAsync.kt index 1186a656..94582f88 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/EmbeddingServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/EmbeddingServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.embeddings.CreateEmbeddingResponse @@ -35,14 +34,12 @@ interface EmbeddingServiceAsync { * Returns a raw HTTP response for `post /embeddings`, but is otherwise the same as * [EmbeddingServiceAsync.create]. */ - @MustBeClosed fun create( params: EmbeddingCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: EmbeddingCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/EvalServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/EvalServiceAsync.kt index 503416d5..7ca10a5e 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/EvalServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/EvalServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.evals.EvalCreateParams @@ -174,14 +173,12 @@ interface EvalServiceAsync { * Returns a raw HTTP response for `post /evals`, but is otherwise the same as * [EvalServiceAsync.create]. */ - @MustBeClosed fun create( params: EvalCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: EvalCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -191,12 +188,10 @@ interface EvalServiceAsync { * Returns a raw HTTP response for `get /evals/{eval_id}`, but is otherwise the same as * [EvalServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(evalId: String): CompletableFuture> = retrieve(evalId, EvalRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( evalId: String, params: EvalRetrieveParams = EvalRetrieveParams.none(), @@ -205,7 +200,6 @@ interface EvalServiceAsync { retrieve(params.toBuilder().evalId(evalId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( evalId: String, params: EvalRetrieveParams = EvalRetrieveParams.none(), @@ -213,21 +207,18 @@ interface EvalServiceAsync { retrieve(evalId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: EvalRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: EvalRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( evalId: String, requestOptions: RequestOptions, @@ -238,12 +229,10 @@ interface EvalServiceAsync { * Returns a raw HTTP response for `post /evals/{eval_id}`, but is otherwise the same as * [EvalServiceAsync.update]. */ - @MustBeClosed fun update(evalId: String): CompletableFuture> = update(evalId, EvalUpdateParams.none()) /** @see [update] */ - @MustBeClosed fun update( evalId: String, params: EvalUpdateParams = EvalUpdateParams.none(), @@ -252,7 +241,6 @@ interface EvalServiceAsync { update(params.toBuilder().evalId(evalId).build(), requestOptions) /** @see [update] */ - @MustBeClosed fun update( evalId: String, params: EvalUpdateParams = EvalUpdateParams.none(), @@ -260,21 +248,18 @@ interface EvalServiceAsync { update(evalId, params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( params: EvalUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [update] */ - @MustBeClosed fun update( params: EvalUpdateParams ): CompletableFuture> = update(params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( evalId: String, requestOptions: RequestOptions, @@ -285,26 +270,22 @@ interface EvalServiceAsync { * Returns a raw HTTP response for `get /evals`, but is otherwise the same as * [EvalServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(EvalListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: EvalListParams = EvalListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: EvalListParams = EvalListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -314,12 +295,10 @@ interface EvalServiceAsync { * Returns a raw HTTP response for `delete /evals/{eval_id}`, but is otherwise the same as * [EvalServiceAsync.delete]. */ - @MustBeClosed fun delete(evalId: String): CompletableFuture> = delete(evalId, EvalDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( evalId: String, params: EvalDeleteParams = EvalDeleteParams.none(), @@ -328,7 +307,6 @@ interface EvalServiceAsync { delete(params.toBuilder().evalId(evalId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( evalId: String, params: EvalDeleteParams = EvalDeleteParams.none(), @@ -336,21 +314,18 @@ interface EvalServiceAsync { delete(evalId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: EvalDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [delete] */ - @MustBeClosed fun delete( params: EvalDeleteParams ): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( evalId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/FileServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/FileServiceAsync.kt index 6cc13c80..7a871e76 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/FileServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/FileServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponseFor @@ -133,12 +132,10 @@ interface FileServiceAsync { delete(fileId, FileDeleteParams.none(), requestOptions) /** Returns the contents of the specified file. */ - @MustBeClosed fun content(fileId: String): CompletableFuture = content(fileId, FileContentParams.none()) /** @see [content] */ - @MustBeClosed fun content( fileId: String, params: FileContentParams = FileContentParams.none(), @@ -147,26 +144,22 @@ interface FileServiceAsync { content(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [content] */ - @MustBeClosed fun content( fileId: String, params: FileContentParams = FileContentParams.none(), ): CompletableFuture = content(fileId, params, RequestOptions.none()) /** @see [content] */ - @MustBeClosed fun content( params: FileContentParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see [content] */ - @MustBeClosed fun content(params: FileContentParams): CompletableFuture = content(params, RequestOptions.none()) /** @see [content] */ - @MustBeClosed fun content(fileId: String, requestOptions: RequestOptions): CompletableFuture = content(fileId, FileContentParams.none(), requestOptions) @@ -177,12 +170,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `post /files`, but is otherwise the same as * [FileServiceAsync.create]. */ - @MustBeClosed fun create(params: FileCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: FileCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -192,12 +183,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /files/{file_id}`, but is otherwise the same as * [FileServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(fileId: String): CompletableFuture> = retrieve(fileId, FileRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, params: FileRetrieveParams = FileRetrieveParams.none(), @@ -206,7 +195,6 @@ interface FileServiceAsync { retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, params: FileRetrieveParams = FileRetrieveParams.none(), @@ -214,19 +202,16 @@ interface FileServiceAsync { retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: FileRetrieveParams): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, requestOptions: RequestOptions, @@ -237,26 +222,22 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /files`, but is otherwise the same as * [FileServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(FileListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: FileListParams = FileListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: FileListParams = FileListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -266,12 +247,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `delete /files/{file_id}`, but is otherwise the same as * [FileServiceAsync.delete]. */ - @MustBeClosed fun delete(fileId: String): CompletableFuture> = delete(fileId, FileDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( fileId: String, params: FileDeleteParams = FileDeleteParams.none(), @@ -280,7 +259,6 @@ interface FileServiceAsync { delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( fileId: String, params: FileDeleteParams = FileDeleteParams.none(), @@ -288,19 +266,16 @@ interface FileServiceAsync { delete(fileId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: FileDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [delete] */ - @MustBeClosed fun delete(params: FileDeleteParams): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( fileId: String, requestOptions: RequestOptions, @@ -311,12 +286,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /files/{file_id}/content`, but is otherwise the same * as [FileServiceAsync.content]. */ - @MustBeClosed fun content(fileId: String): CompletableFuture = content(fileId, FileContentParams.none()) /** @see [content] */ - @MustBeClosed fun content( fileId: String, params: FileContentParams = FileContentParams.none(), @@ -325,26 +298,22 @@ interface FileServiceAsync { content(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [content] */ - @MustBeClosed fun content( fileId: String, params: FileContentParams = FileContentParams.none(), ): CompletableFuture = content(fileId, params, RequestOptions.none()) /** @see [content] */ - @MustBeClosed fun content( params: FileContentParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see [content] */ - @MustBeClosed fun content(params: FileContentParams): CompletableFuture = content(params, RequestOptions.none()) /** @see [content] */ - @MustBeClosed fun content( fileId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsync.kt index 0494197b..e1a9975f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ImageServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.images.ImageCreateVariationParams @@ -61,14 +60,12 @@ interface ImageServiceAsync { * Returns a raw HTTP response for `post /images/variations`, but is otherwise the same as * [ImageServiceAsync.createVariation]. */ - @MustBeClosed fun createVariation( params: ImageCreateVariationParams ): CompletableFuture> = createVariation(params, RequestOptions.none()) /** @see [createVariation] */ - @MustBeClosed fun createVariation( params: ImageCreateVariationParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -78,12 +75,10 @@ interface ImageServiceAsync { * Returns a raw HTTP response for `post /images/edits`, but is otherwise the same as * [ImageServiceAsync.edit]. */ - @MustBeClosed fun edit(params: ImageEditParams): CompletableFuture> = edit(params, RequestOptions.none()) /** @see [edit] */ - @MustBeClosed fun edit( params: ImageEditParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -93,14 +88,12 @@ interface ImageServiceAsync { * Returns a raw HTTP response for `post /images/generations`, but is otherwise the same as * [ImageServiceAsync.generate]. */ - @MustBeClosed fun generate( params: ImageGenerateParams ): CompletableFuture> = generate(params, RequestOptions.none()) /** @see [generate] */ - @MustBeClosed fun generate( params: ImageGenerateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ModelServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ModelServiceAsync.kt index 993f48db..cc9d0a0c 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ModelServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ModelServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.models.Model @@ -117,12 +116,10 @@ interface ModelServiceAsync { * Returns a raw HTTP response for `get /models/{model}`, but is otherwise the same as * [ModelServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(model: String): CompletableFuture> = retrieve(model, ModelRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( model: String, params: ModelRetrieveParams = ModelRetrieveParams.none(), @@ -131,7 +128,6 @@ interface ModelServiceAsync { retrieve(params.toBuilder().model(model).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( model: String, params: ModelRetrieveParams = ModelRetrieveParams.none(), @@ -139,19 +135,16 @@ interface ModelServiceAsync { retrieve(model, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ModelRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: ModelRetrieveParams): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( model: String, requestOptions: RequestOptions, @@ -162,26 +155,22 @@ interface ModelServiceAsync { * Returns a raw HTTP response for `get /models`, but is otherwise the same as * [ModelServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(ModelListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: ModelListParams = ModelListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: ModelListParams = ModelListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -191,12 +180,10 @@ interface ModelServiceAsync { * Returns a raw HTTP response for `delete /models/{model}`, but is otherwise the same as * [ModelServiceAsync.delete]. */ - @MustBeClosed fun delete(model: String): CompletableFuture> = delete(model, ModelDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( model: String, params: ModelDeleteParams = ModelDeleteParams.none(), @@ -205,7 +192,6 @@ interface ModelServiceAsync { delete(params.toBuilder().model(model).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( model: String, params: ModelDeleteParams = ModelDeleteParams.none(), @@ -213,19 +199,16 @@ interface ModelServiceAsync { delete(model, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: ModelDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [delete] */ - @MustBeClosed fun delete(params: ModelDeleteParams): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( model: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ModerationServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ModerationServiceAsync.kt index 901ed8ce..0d598ccf 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ModerationServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ModerationServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.moderations.ModerationCreateParams @@ -39,14 +38,12 @@ interface ModerationServiceAsync { * Returns a raw HTTP response for `post /moderations`, but is otherwise the same as * [ModerationServiceAsync.create]. */ - @MustBeClosed fun create( params: ModerationCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: ModerationCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt index a7404439..e4570c57 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/ResponseServiceAsync.kt @@ -214,12 +214,10 @@ interface ResponseServiceAsync { * Returns a raw HTTP response for `post /responses`, but is otherwise the same as * [ResponseServiceAsync.create]. */ - @MustBeClosed fun create(params: ResponseCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: ResponseCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -246,12 +244,10 @@ interface ResponseServiceAsync { * Returns a raw HTTP response for `get /responses/{response_id}`, but is otherwise the same * as [ResponseServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(responseId: String): CompletableFuture> = retrieve(responseId, ResponseRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( responseId: String, params: ResponseRetrieveParams = ResponseRetrieveParams.none(), @@ -260,7 +256,6 @@ interface ResponseServiceAsync { retrieve(params.toBuilder().responseId(responseId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( responseId: String, params: ResponseRetrieveParams = ResponseRetrieveParams.none(), @@ -268,19 +263,16 @@ interface ResponseServiceAsync { retrieve(responseId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ResponseRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: ResponseRetrieveParams): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( responseId: String, requestOptions: RequestOptions, @@ -340,12 +332,10 @@ interface ResponseServiceAsync { * Returns a raw HTTP response for `delete /responses/{response_id}`, but is otherwise the * same as [ResponseServiceAsync.delete]. */ - @MustBeClosed fun delete(responseId: String): CompletableFuture = delete(responseId, ResponseDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( responseId: String, params: ResponseDeleteParams = ResponseDeleteParams.none(), @@ -354,26 +344,22 @@ interface ResponseServiceAsync { delete(params.toBuilder().responseId(responseId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( responseId: String, params: ResponseDeleteParams = ResponseDeleteParams.none(), ): CompletableFuture = delete(responseId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: ResponseDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see [delete] */ - @MustBeClosed fun delete(params: ResponseDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( responseId: String, requestOptions: RequestOptions, @@ -384,12 +370,10 @@ interface ResponseServiceAsync { * Returns a raw HTTP response for `post /responses/{response_id}/cancel`, but is otherwise * the same as [ResponseServiceAsync.cancel]. */ - @MustBeClosed fun cancel(responseId: String): CompletableFuture = cancel(responseId, ResponseCancelParams.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( responseId: String, params: ResponseCancelParams = ResponseCancelParams.none(), @@ -398,26 +382,22 @@ interface ResponseServiceAsync { cancel(params.toBuilder().responseId(responseId).build(), requestOptions) /** @see [cancel] */ - @MustBeClosed fun cancel( responseId: String, params: ResponseCancelParams = ResponseCancelParams.none(), ): CompletableFuture = cancel(responseId, params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( params: ResponseCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture /** @see [cancel] */ - @MustBeClosed fun cancel(params: ResponseCancelParams): CompletableFuture = cancel(params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( responseId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/UploadServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/UploadServiceAsync.kt index 98218ac5..fb500d7f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/UploadServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/UploadServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.uploads.Upload @@ -127,12 +126,10 @@ interface UploadServiceAsync { * Returns a raw HTTP response for `post /uploads`, but is otherwise the same as * [UploadServiceAsync.create]. */ - @MustBeClosed fun create(params: UploadCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: UploadCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -142,12 +139,10 @@ interface UploadServiceAsync { * Returns a raw HTTP response for `post /uploads/{upload_id}/cancel`, but is otherwise the * same as [UploadServiceAsync.cancel]. */ - @MustBeClosed fun cancel(uploadId: String): CompletableFuture> = cancel(uploadId, UploadCancelParams.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( uploadId: String, params: UploadCancelParams = UploadCancelParams.none(), @@ -156,7 +151,6 @@ interface UploadServiceAsync { cancel(params.toBuilder().uploadId(uploadId).build(), requestOptions) /** @see [cancel] */ - @MustBeClosed fun cancel( uploadId: String, params: UploadCancelParams = UploadCancelParams.none(), @@ -164,19 +158,16 @@ interface UploadServiceAsync { cancel(uploadId, params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( params: UploadCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [cancel] */ - @MustBeClosed fun cancel(params: UploadCancelParams): CompletableFuture> = cancel(params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( uploadId: String, requestOptions: RequestOptions, @@ -187,7 +178,6 @@ interface UploadServiceAsync { * Returns a raw HTTP response for `post /uploads/{upload_id}/complete`, but is otherwise * the same as [UploadServiceAsync.complete]. */ - @MustBeClosed fun complete( uploadId: String, params: UploadCompleteParams, @@ -195,7 +185,6 @@ interface UploadServiceAsync { complete(uploadId, params, RequestOptions.none()) /** @see [complete] */ - @MustBeClosed fun complete( uploadId: String, params: UploadCompleteParams, @@ -204,12 +193,10 @@ interface UploadServiceAsync { complete(params.toBuilder().uploadId(uploadId).build(), requestOptions) /** @see [complete] */ - @MustBeClosed fun complete(params: UploadCompleteParams): CompletableFuture> = complete(params, RequestOptions.none()) /** @see [complete] */ - @MustBeClosed fun complete( params: UploadCompleteParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/VectorStoreServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/VectorStoreServiceAsync.kt index ff07354c..c6584162 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/VectorStoreServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/VectorStoreServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.vectorstores.VectorStore @@ -210,25 +209,21 @@ interface VectorStoreServiceAsync { * Returns a raw HTTP response for `post /vector_stores`, but is otherwise the same as * [VectorStoreServiceAsync.create]. */ - @MustBeClosed fun create(): CompletableFuture> = create(VectorStoreCreateParams.none()) /** @see [create] */ - @MustBeClosed fun create( params: VectorStoreCreateParams = VectorStoreCreateParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [create] */ - @MustBeClosed fun create( params: VectorStoreCreateParams = VectorStoreCreateParams.none() ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( requestOptions: RequestOptions ): CompletableFuture> = @@ -238,12 +233,10 @@ interface VectorStoreServiceAsync { * Returns a raw HTTP response for `get /vector_stores/{vector_store_id}`, but is otherwise * the same as [VectorStoreServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(vectorStoreId: String): CompletableFuture> = retrieve(vectorStoreId, VectorStoreRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( vectorStoreId: String, params: VectorStoreRetrieveParams = VectorStoreRetrieveParams.none(), @@ -252,7 +245,6 @@ interface VectorStoreServiceAsync { retrieve(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( vectorStoreId: String, params: VectorStoreRetrieveParams = VectorStoreRetrieveParams.none(), @@ -260,20 +252,17 @@ interface VectorStoreServiceAsync { retrieve(vectorStoreId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: VectorStoreRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: VectorStoreRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( vectorStoreId: String, requestOptions: RequestOptions, @@ -284,12 +273,10 @@ interface VectorStoreServiceAsync { * Returns a raw HTTP response for `post /vector_stores/{vector_store_id}`, but is otherwise * the same as [VectorStoreServiceAsync.update]. */ - @MustBeClosed fun update(vectorStoreId: String): CompletableFuture> = update(vectorStoreId, VectorStoreUpdateParams.none()) /** @see [update] */ - @MustBeClosed fun update( vectorStoreId: String, params: VectorStoreUpdateParams = VectorStoreUpdateParams.none(), @@ -298,7 +285,6 @@ interface VectorStoreServiceAsync { update(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [update] */ - @MustBeClosed fun update( vectorStoreId: String, params: VectorStoreUpdateParams = VectorStoreUpdateParams.none(), @@ -306,20 +292,17 @@ interface VectorStoreServiceAsync { update(vectorStoreId, params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( params: VectorStoreUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [update] */ - @MustBeClosed fun update( params: VectorStoreUpdateParams ): CompletableFuture> = update(params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( vectorStoreId: String, requestOptions: RequestOptions, @@ -330,26 +313,22 @@ interface VectorStoreServiceAsync { * Returns a raw HTTP response for `get /vector_stores`, but is otherwise the same as * [VectorStoreServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(VectorStoreListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: VectorStoreListParams = VectorStoreListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: VectorStoreListParams = VectorStoreListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -359,12 +338,10 @@ interface VectorStoreServiceAsync { * Returns a raw HTTP response for `delete /vector_stores/{vector_store_id}`, but is * otherwise the same as [VectorStoreServiceAsync.delete]. */ - @MustBeClosed fun delete(vectorStoreId: String): CompletableFuture> = delete(vectorStoreId, VectorStoreDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( vectorStoreId: String, params: VectorStoreDeleteParams = VectorStoreDeleteParams.none(), @@ -373,7 +350,6 @@ interface VectorStoreServiceAsync { delete(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( vectorStoreId: String, params: VectorStoreDeleteParams = VectorStoreDeleteParams.none(), @@ -381,21 +357,18 @@ interface VectorStoreServiceAsync { delete(vectorStoreId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: VectorStoreDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [delete] */ - @MustBeClosed fun delete( params: VectorStoreDeleteParams ): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( vectorStoreId: String, requestOptions: RequestOptions, @@ -406,7 +379,6 @@ interface VectorStoreServiceAsync { * Returns a raw HTTP response for `post /vector_stores/{vector_store_id}/search`, but is * otherwise the same as [VectorStoreServiceAsync.search]. */ - @MustBeClosed fun search( vectorStoreId: String, params: VectorStoreSearchParams, @@ -414,7 +386,6 @@ interface VectorStoreServiceAsync { search(vectorStoreId, params, RequestOptions.none()) /** @see [search] */ - @MustBeClosed fun search( vectorStoreId: String, params: VectorStoreSearchParams, @@ -423,14 +394,12 @@ interface VectorStoreServiceAsync { search(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [search] */ - @MustBeClosed fun search( params: VectorStoreSearchParams ): CompletableFuture> = search(params, RequestOptions.none()) /** @see [search] */ - @MustBeClosed fun search( params: VectorStoreSearchParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/audio/SpeechServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/audio/SpeechServiceAsync.kt index 95e2744d..8a2ab2ae 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/audio/SpeechServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/audio/SpeechServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.audio -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponse import com.openai.models.audio.speech.SpeechCreateParams @@ -16,12 +15,10 @@ interface SpeechServiceAsync { fun withRawResponse(): WithRawResponse /** Generates audio from the input text. */ - @MustBeClosed fun create(params: SpeechCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: SpeechCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -36,12 +33,10 @@ interface SpeechServiceAsync { * Returns a raw HTTP response for `post /audio/speech`, but is otherwise the same as * [SpeechServiceAsync.create]. */ - @MustBeClosed fun create(params: SpeechCreateParams): CompletableFuture = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: SpeechCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsync.kt index 377a6f85..0a39d98f 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranscriptionServiceAsync.kt @@ -51,14 +51,12 @@ interface TranscriptionServiceAsync { * Returns a raw HTTP response for `post /audio/transcriptions`, but is otherwise the same * as [TranscriptionServiceAsync.create]. */ - @MustBeClosed fun create( params: TranscriptionCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: TranscriptionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranslationServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranslationServiceAsync.kt index c4528a0b..8685bf75 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranslationServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/audio/TranslationServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.audio -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.audio.translations.TranslationCreateParams @@ -36,14 +35,12 @@ interface TranslationServiceAsync { * Returns a raw HTTP response for `post /audio/translations`, but is otherwise the same as * [TranslationServiceAsync.create]. */ - @MustBeClosed fun create( params: TranslationCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: TranslationCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt index 2890cb31..3df83562 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/chat/ChatCompletionServiceAsync.kt @@ -222,14 +222,12 @@ interface ChatCompletionServiceAsync { * Returns a raw HTTP response for `post /chat/completions`, but is otherwise the same as * [ChatCompletionServiceAsync.create]. */ - @MustBeClosed fun create( params: ChatCompletionCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: ChatCompletionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -256,12 +254,10 @@ interface ChatCompletionServiceAsync { * Returns a raw HTTP response for `get /chat/completions/{completion_id}`, but is otherwise * the same as [ChatCompletionServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(completionId: String): CompletableFuture> = retrieve(completionId, ChatCompletionRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( completionId: String, params: ChatCompletionRetrieveParams = ChatCompletionRetrieveParams.none(), @@ -270,7 +266,6 @@ interface ChatCompletionServiceAsync { retrieve(params.toBuilder().completionId(completionId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( completionId: String, params: ChatCompletionRetrieveParams = ChatCompletionRetrieveParams.none(), @@ -278,21 +273,18 @@ interface ChatCompletionServiceAsync { retrieve(completionId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ChatCompletionRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ChatCompletionRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( completionId: String, requestOptions: RequestOptions, @@ -303,7 +295,6 @@ interface ChatCompletionServiceAsync { * Returns a raw HTTP response for `post /chat/completions/{completion_id}`, but is * otherwise the same as [ChatCompletionServiceAsync.update]. */ - @MustBeClosed fun update( completionId: String, params: ChatCompletionUpdateParams, @@ -311,7 +302,6 @@ interface ChatCompletionServiceAsync { update(completionId, params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( completionId: String, params: ChatCompletionUpdateParams, @@ -320,14 +310,12 @@ interface ChatCompletionServiceAsync { update(params.toBuilder().completionId(completionId).build(), requestOptions) /** @see [update] */ - @MustBeClosed fun update( params: ChatCompletionUpdateParams ): CompletableFuture> = update(params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( params: ChatCompletionUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -337,26 +325,22 @@ interface ChatCompletionServiceAsync { * Returns a raw HTTP response for `get /chat/completions`, but is otherwise the same as * [ChatCompletionServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(ChatCompletionListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: ChatCompletionListParams = ChatCompletionListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: ChatCompletionListParams = ChatCompletionListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -366,14 +350,12 @@ interface ChatCompletionServiceAsync { * Returns a raw HTTP response for `delete /chat/completions/{completion_id}`, but is * otherwise the same as [ChatCompletionServiceAsync.delete]. */ - @MustBeClosed fun delete( completionId: String ): CompletableFuture> = delete(completionId, ChatCompletionDeleteParams.none()) /** @see [delete] */ - @MustBeClosed fun delete( completionId: String, params: ChatCompletionDeleteParams = ChatCompletionDeleteParams.none(), @@ -382,7 +364,6 @@ interface ChatCompletionServiceAsync { delete(params.toBuilder().completionId(completionId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( completionId: String, params: ChatCompletionDeleteParams = ChatCompletionDeleteParams.none(), @@ -390,21 +371,18 @@ interface ChatCompletionServiceAsync { delete(completionId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: ChatCompletionDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [delete] */ - @MustBeClosed fun delete( params: ChatCompletionDeleteParams ): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( completionId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/chat/completions/MessageServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/chat/completions/MessageServiceAsync.kt index 6edcc5a0..b6182dad 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/chat/completions/MessageServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/chat/completions/MessageServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.chat.completions -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.chat.completions.messages.MessageListPageAsync @@ -63,12 +62,10 @@ interface MessageServiceAsync { * Returns a raw HTTP response for `get /chat/completions/{completion_id}/messages`, but is * otherwise the same as [MessageServiceAsync.list]. */ - @MustBeClosed fun list(completionId: String): CompletableFuture> = list(completionId, MessageListParams.none()) /** @see [list] */ - @MustBeClosed fun list( completionId: String, params: MessageListParams = MessageListParams.none(), @@ -77,7 +74,6 @@ interface MessageServiceAsync { list(params.toBuilder().completionId(completionId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( completionId: String, params: MessageListParams = MessageListParams.none(), @@ -85,21 +81,18 @@ interface MessageServiceAsync { list(completionId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: MessageListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: MessageListParams ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( completionId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/FileServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/FileServiceAsync.kt index af6c4a7c..03f07130 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/FileServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/FileServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.containers -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponse import com.openai.core.http.HttpResponseFor @@ -154,12 +153,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `post /containers/{container_id}/files`, but is otherwise * the same as [FileServiceAsync.create]. */ - @MustBeClosed fun create(containerId: String): CompletableFuture> = create(containerId, FileCreateParams.none()) /** @see [create] */ - @MustBeClosed fun create( containerId: String, params: FileCreateParams = FileCreateParams.none(), @@ -168,7 +165,6 @@ interface FileServiceAsync { create(params.toBuilder().containerId(containerId).build(), requestOptions) /** @see [create] */ - @MustBeClosed fun create( containerId: String, params: FileCreateParams = FileCreateParams.none(), @@ -176,21 +172,18 @@ interface FileServiceAsync { create(containerId, params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: FileCreateParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [create] */ - @MustBeClosed fun create( params: FileCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( containerId: String, requestOptions: RequestOptions, @@ -201,7 +194,6 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /containers/{container_id}/files/{file_id}`, but is * otherwise the same as [FileServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( fileId: String, params: FileRetrieveParams, @@ -209,7 +201,6 @@ interface FileServiceAsync { retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, params: FileRetrieveParams, @@ -218,14 +209,12 @@ interface FileServiceAsync { retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -235,12 +224,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /containers/{container_id}/files`, but is otherwise * the same as [FileServiceAsync.list]. */ - @MustBeClosed fun list(containerId: String): CompletableFuture> = list(containerId, FileListParams.none()) /** @see [list] */ - @MustBeClosed fun list( containerId: String, params: FileListParams = FileListParams.none(), @@ -249,7 +236,6 @@ interface FileServiceAsync { list(params.toBuilder().containerId(containerId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( containerId: String, params: FileListParams = FileListParams.none(), @@ -257,19 +243,16 @@ interface FileServiceAsync { list(containerId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: FileListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list(params: FileListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( containerId: String, requestOptions: RequestOptions, @@ -280,12 +263,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `delete /containers/{container_id}/files/{file_id}`, but * is otherwise the same as [FileServiceAsync.delete]. */ - @MustBeClosed fun delete(fileId: String, params: FileDeleteParams): CompletableFuture = delete(fileId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( fileId: String, params: FileDeleteParams, @@ -294,12 +275,10 @@ interface FileServiceAsync { delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete(params: FileDeleteParams): CompletableFuture = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: FileDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt index 9ece51d3..00298b94 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/containers/files/ContentServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.containers.files -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponse import com.openai.models.containers.files.content.ContentRetrieveParams @@ -16,12 +15,10 @@ interface ContentServiceAsync { fun withRawResponse(): WithRawResponse /** Retrieve Container File Content */ - @MustBeClosed fun retrieve(fileId: String, params: ContentRetrieveParams): CompletableFuture = retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, params: ContentRetrieveParams, @@ -30,12 +27,10 @@ interface ContentServiceAsync { retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: ContentRetrieveParams): CompletableFuture = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -50,14 +45,12 @@ interface ContentServiceAsync { * Returns a raw HTTP response for `get /containers/{container_id}/files/{file_id}/content`, * but is otherwise the same as [ContentServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( fileId: String, params: ContentRetrieveParams, ): CompletableFuture = retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, params: ContentRetrieveParams, @@ -66,12 +59,10 @@ interface ContentServiceAsync { retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: ContentRetrieveParams): CompletableFuture = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: ContentRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/evals/RunServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/evals/RunServiceAsync.kt index 55f66db0..ba3b60c9 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/evals/RunServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/evals/RunServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.evals -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.evals.runs.RunCancelParams @@ -160,7 +159,6 @@ interface RunServiceAsync { * Returns a raw HTTP response for `post /evals/{eval_id}/runs`, but is otherwise the same * as [RunServiceAsync.create]. */ - @MustBeClosed fun create( evalId: String, params: RunCreateParams, @@ -168,7 +166,6 @@ interface RunServiceAsync { create(evalId, params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( evalId: String, params: RunCreateParams, @@ -177,12 +174,10 @@ interface RunServiceAsync { create(params.toBuilder().evalId(evalId).build(), requestOptions) /** @see [create] */ - @MustBeClosed fun create(params: RunCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: RunCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -192,7 +187,6 @@ interface RunServiceAsync { * Returns a raw HTTP response for `get /evals/{eval_id}/runs/{run_id}`, but is otherwise * the same as [RunServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( runId: String, params: RunRetrieveParams, @@ -200,7 +194,6 @@ interface RunServiceAsync { retrieve(runId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( runId: String, params: RunRetrieveParams, @@ -209,14 +202,12 @@ interface RunServiceAsync { retrieve(params.toBuilder().runId(runId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: RunRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: RunRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -226,12 +217,10 @@ interface RunServiceAsync { * Returns a raw HTTP response for `get /evals/{eval_id}/runs`, but is otherwise the same as * [RunServiceAsync.list]. */ - @MustBeClosed fun list(evalId: String): CompletableFuture> = list(evalId, RunListParams.none()) /** @see [list] */ - @MustBeClosed fun list( evalId: String, params: RunListParams = RunListParams.none(), @@ -240,7 +229,6 @@ interface RunServiceAsync { list(params.toBuilder().evalId(evalId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( evalId: String, params: RunListParams = RunListParams.none(), @@ -248,19 +236,16 @@ interface RunServiceAsync { list(evalId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: RunListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list(params: RunListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( evalId: String, requestOptions: RequestOptions, @@ -271,7 +256,6 @@ interface RunServiceAsync { * Returns a raw HTTP response for `delete /evals/{eval_id}/runs/{run_id}`, but is otherwise * the same as [RunServiceAsync.delete]. */ - @MustBeClosed fun delete( runId: String, params: RunDeleteParams, @@ -279,7 +263,6 @@ interface RunServiceAsync { delete(runId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( runId: String, params: RunDeleteParams, @@ -288,12 +271,10 @@ interface RunServiceAsync { delete(params.toBuilder().runId(runId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete(params: RunDeleteParams): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: RunDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -303,7 +284,6 @@ interface RunServiceAsync { * Returns a raw HTTP response for `post /evals/{eval_id}/runs/{run_id}`, but is otherwise * the same as [RunServiceAsync.cancel]. */ - @MustBeClosed fun cancel( runId: String, params: RunCancelParams, @@ -311,7 +291,6 @@ interface RunServiceAsync { cancel(runId, params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( runId: String, params: RunCancelParams, @@ -320,12 +299,10 @@ interface RunServiceAsync { cancel(params.toBuilder().runId(runId).build(), requestOptions) /** @see [cancel] */ - @MustBeClosed fun cancel(params: RunCancelParams): CompletableFuture> = cancel(params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( params: RunCancelParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/evals/runs/OutputItemServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/evals/runs/OutputItemServiceAsync.kt index 6373f511..3cb4c9c2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/evals/runs/OutputItemServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/evals/runs/OutputItemServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.evals.runs -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.evals.runs.outputitems.OutputItemListPageAsync @@ -78,7 +77,6 @@ interface OutputItemServiceAsync { * /evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}`, but is otherwise the same * as [OutputItemServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( outputItemId: String, params: OutputItemRetrieveParams, @@ -86,7 +84,6 @@ interface OutputItemServiceAsync { retrieve(outputItemId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( outputItemId: String, params: OutputItemRetrieveParams, @@ -95,14 +92,12 @@ interface OutputItemServiceAsync { retrieve(params.toBuilder().outputItemId(outputItemId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: OutputItemRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: OutputItemRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -112,7 +107,6 @@ interface OutputItemServiceAsync { * Returns a raw HTTP response for `get /evals/{eval_id}/runs/{run_id}/output_items`, but is * otherwise the same as [OutputItemServiceAsync.list]. */ - @MustBeClosed fun list( runId: String, params: OutputItemListParams, @@ -120,7 +114,6 @@ interface OutputItemServiceAsync { list(runId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( runId: String, params: OutputItemListParams, @@ -129,14 +122,12 @@ interface OutputItemServiceAsync { list(params.toBuilder().runId(runId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( params: OutputItemListParams ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: OutputItemListParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/JobServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/JobServiceAsync.kt index 9ed46708..bda9839a 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/JobServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/JobServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.finetuning -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.finetuning.jobs.FineTuningJob @@ -251,12 +250,10 @@ interface JobServiceAsync { * Returns a raw HTTP response for `post /fine_tuning/jobs`, but is otherwise the same as * [JobServiceAsync.create]. */ - @MustBeClosed fun create(params: JobCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: JobCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -266,12 +263,10 @@ interface JobServiceAsync { * Returns a raw HTTP response for `get /fine_tuning/jobs/{fine_tuning_job_id}`, but is * otherwise the same as [JobServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve(fineTuningJobId: String): CompletableFuture> = retrieve(fineTuningJobId, JobRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fineTuningJobId: String, params: JobRetrieveParams = JobRetrieveParams.none(), @@ -280,7 +275,6 @@ interface JobServiceAsync { retrieve(params.toBuilder().fineTuningJobId(fineTuningJobId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fineTuningJobId: String, params: JobRetrieveParams = JobRetrieveParams.none(), @@ -288,19 +282,16 @@ interface JobServiceAsync { retrieve(fineTuningJobId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: JobRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve(params: JobRetrieveParams): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fineTuningJobId: String, requestOptions: RequestOptions, @@ -311,26 +302,22 @@ interface JobServiceAsync { * Returns a raw HTTP response for `get /fine_tuning/jobs`, but is otherwise the same as * [JobServiceAsync.list]. */ - @MustBeClosed fun list(): CompletableFuture> = list(JobListParams.none()) /** @see [list] */ - @MustBeClosed fun list( params: JobListParams = JobListParams.none(), requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: JobListParams = JobListParams.none() ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( requestOptions: RequestOptions ): CompletableFuture> = @@ -340,12 +327,10 @@ interface JobServiceAsync { * Returns a raw HTTP response for `post /fine_tuning/jobs/{fine_tuning_job_id}/cancel`, but * is otherwise the same as [JobServiceAsync.cancel]. */ - @MustBeClosed fun cancel(fineTuningJobId: String): CompletableFuture> = cancel(fineTuningJobId, JobCancelParams.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( fineTuningJobId: String, params: JobCancelParams = JobCancelParams.none(), @@ -354,7 +339,6 @@ interface JobServiceAsync { cancel(params.toBuilder().fineTuningJobId(fineTuningJobId).build(), requestOptions) /** @see [cancel] */ - @MustBeClosed fun cancel( fineTuningJobId: String, params: JobCancelParams = JobCancelParams.none(), @@ -362,19 +346,16 @@ interface JobServiceAsync { cancel(fineTuningJobId, params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( params: JobCancelParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [cancel] */ - @MustBeClosed fun cancel(params: JobCancelParams): CompletableFuture> = cancel(params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( fineTuningJobId: String, requestOptions: RequestOptions, @@ -385,14 +366,12 @@ interface JobServiceAsync { * Returns a raw HTTP response for `get /fine_tuning/jobs/{fine_tuning_job_id}/events`, but * is otherwise the same as [JobServiceAsync.listEvents]. */ - @MustBeClosed fun listEvents( fineTuningJobId: String ): CompletableFuture> = listEvents(fineTuningJobId, JobListEventsParams.none()) /** @see [listEvents] */ - @MustBeClosed fun listEvents( fineTuningJobId: String, params: JobListEventsParams = JobListEventsParams.none(), @@ -401,7 +380,6 @@ interface JobServiceAsync { listEvents(params.toBuilder().fineTuningJobId(fineTuningJobId).build(), requestOptions) /** @see [listEvents] */ - @MustBeClosed fun listEvents( fineTuningJobId: String, params: JobListEventsParams = JobListEventsParams.none(), @@ -409,21 +387,18 @@ interface JobServiceAsync { listEvents(fineTuningJobId, params, RequestOptions.none()) /** @see [listEvents] */ - @MustBeClosed fun listEvents( params: JobListEventsParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [listEvents] */ - @MustBeClosed fun listEvents( params: JobListEventsParams ): CompletableFuture> = listEvents(params, RequestOptions.none()) /** @see [listEvents] */ - @MustBeClosed fun listEvents( fineTuningJobId: String, requestOptions: RequestOptions, @@ -434,12 +409,10 @@ interface JobServiceAsync { * Returns a raw HTTP response for `post /fine_tuning/jobs/{fine_tuning_job_id}/pause`, but * is otherwise the same as [JobServiceAsync.pause]. */ - @MustBeClosed fun pause(fineTuningJobId: String): CompletableFuture> = pause(fineTuningJobId, JobPauseParams.none()) /** @see [pause] */ - @MustBeClosed fun pause( fineTuningJobId: String, params: JobPauseParams = JobPauseParams.none(), @@ -448,7 +421,6 @@ interface JobServiceAsync { pause(params.toBuilder().fineTuningJobId(fineTuningJobId).build(), requestOptions) /** @see [pause] */ - @MustBeClosed fun pause( fineTuningJobId: String, params: JobPauseParams = JobPauseParams.none(), @@ -456,19 +428,16 @@ interface JobServiceAsync { pause(fineTuningJobId, params, RequestOptions.none()) /** @see [pause] */ - @MustBeClosed fun pause( params: JobPauseParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [pause] */ - @MustBeClosed fun pause(params: JobPauseParams): CompletableFuture> = pause(params, RequestOptions.none()) /** @see [pause] */ - @MustBeClosed fun pause( fineTuningJobId: String, requestOptions: RequestOptions, @@ -479,12 +448,10 @@ interface JobServiceAsync { * Returns a raw HTTP response for `post /fine_tuning/jobs/{fine_tuning_job_id}/resume`, but * is otherwise the same as [JobServiceAsync.resume]. */ - @MustBeClosed fun resume(fineTuningJobId: String): CompletableFuture> = resume(fineTuningJobId, JobResumeParams.none()) /** @see [resume] */ - @MustBeClosed fun resume( fineTuningJobId: String, params: JobResumeParams = JobResumeParams.none(), @@ -493,7 +460,6 @@ interface JobServiceAsync { resume(params.toBuilder().fineTuningJobId(fineTuningJobId).build(), requestOptions) /** @see [resume] */ - @MustBeClosed fun resume( fineTuningJobId: String, params: JobResumeParams = JobResumeParams.none(), @@ -501,19 +467,16 @@ interface JobServiceAsync { resume(fineTuningJobId, params, RequestOptions.none()) /** @see [resume] */ - @MustBeClosed fun resume( params: JobResumeParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [resume] */ - @MustBeClosed fun resume(params: JobResumeParams): CompletableFuture> = resume(params, RequestOptions.none()) /** @see [resume] */ - @MustBeClosed fun resume( fineTuningJobId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/alpha/GraderServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/alpha/GraderServiceAsync.kt index a11d77f1..d6b04a06 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/alpha/GraderServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/alpha/GraderServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.finetuning.alpha -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.finetuning.alpha.graders.GraderRunParams @@ -47,12 +46,10 @@ interface GraderServiceAsync { * Returns a raw HTTP response for `post /fine_tuning/alpha/graders/run`, but is otherwise * the same as [GraderServiceAsync.run]. */ - @MustBeClosed fun run(params: GraderRunParams): CompletableFuture> = run(params, RequestOptions.none()) /** @see [run] */ - @MustBeClosed fun run( params: GraderRunParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -62,14 +59,12 @@ interface GraderServiceAsync { * Returns a raw HTTP response for `post /fine_tuning/alpha/graders/validate`, but is * otherwise the same as [GraderServiceAsync.validate]. */ - @MustBeClosed fun validate( params: GraderValidateParams ): CompletableFuture> = validate(params, RequestOptions.none()) /** @see [validate] */ - @MustBeClosed fun validate( params: GraderValidateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsync.kt index 0d293bcb..68829102 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/checkpoints/PermissionServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.finetuning.checkpoints -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.finetuning.checkpoints.permissions.PermissionCreatePageAsync @@ -138,7 +137,6 @@ interface PermissionServiceAsync { * /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions`, but is otherwise the * same as [PermissionServiceAsync.create]. */ - @MustBeClosed fun create( fineTunedModelCheckpoint: String, params: PermissionCreateParams, @@ -146,7 +144,6 @@ interface PermissionServiceAsync { create(fineTunedModelCheckpoint, params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( fineTunedModelCheckpoint: String, params: PermissionCreateParams, @@ -158,14 +155,12 @@ interface PermissionServiceAsync { ) /** @see [create] */ - @MustBeClosed fun create( params: PermissionCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: PermissionCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -176,14 +171,12 @@ interface PermissionServiceAsync { * /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions`, but is otherwise the * same as [PermissionServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( fineTunedModelCheckpoint: String ): CompletableFuture> = retrieve(fineTunedModelCheckpoint, PermissionRetrieveParams.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fineTunedModelCheckpoint: String, params: PermissionRetrieveParams = PermissionRetrieveParams.none(), @@ -195,7 +188,6 @@ interface PermissionServiceAsync { ) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fineTunedModelCheckpoint: String, params: PermissionRetrieveParams = PermissionRetrieveParams.none(), @@ -203,21 +195,18 @@ interface PermissionServiceAsync { retrieve(fineTunedModelCheckpoint, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: PermissionRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: PermissionRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fineTunedModelCheckpoint: String, requestOptions: RequestOptions, @@ -229,7 +218,6 @@ interface PermissionServiceAsync { * /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}`, but * is otherwise the same as [PermissionServiceAsync.delete]. */ - @MustBeClosed fun delete( permissionId: String, params: PermissionDeleteParams, @@ -237,7 +225,6 @@ interface PermissionServiceAsync { delete(permissionId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( permissionId: String, params: PermissionDeleteParams, @@ -246,14 +233,12 @@ interface PermissionServiceAsync { delete(params.toBuilder().permissionId(permissionId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( params: PermissionDeleteParams ): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: PermissionDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/jobs/CheckpointServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/jobs/CheckpointServiceAsync.kt index b53b92a9..d19ae077 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/jobs/CheckpointServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/finetuning/jobs/CheckpointServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.finetuning.jobs -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.finetuning.jobs.checkpoints.CheckpointListPageAsync @@ -62,14 +61,12 @@ interface CheckpointServiceAsync { * Returns a raw HTTP response for `get /fine_tuning/jobs/{fine_tuning_job_id}/checkpoints`, * but is otherwise the same as [CheckpointServiceAsync.list]. */ - @MustBeClosed fun list( fineTuningJobId: String ): CompletableFuture> = list(fineTuningJobId, CheckpointListParams.none()) /** @see [list] */ - @MustBeClosed fun list( fineTuningJobId: String, params: CheckpointListParams = CheckpointListParams.none(), @@ -78,7 +75,6 @@ interface CheckpointServiceAsync { list(params.toBuilder().fineTuningJobId(fineTuningJobId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( fineTuningJobId: String, params: CheckpointListParams = CheckpointListParams.none(), @@ -86,21 +82,18 @@ interface CheckpointServiceAsync { list(fineTuningJobId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: CheckpointListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: CheckpointListParams ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( fineTuningJobId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/responses/InputItemServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/responses/InputItemServiceAsync.kt index 11b92dbf..90be2ad5 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/responses/InputItemServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/responses/InputItemServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.responses -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.responses.inputitems.InputItemListPageAsync @@ -60,12 +59,10 @@ interface InputItemServiceAsync { * Returns a raw HTTP response for `get /responses/{response_id}/input_items`, but is * otherwise the same as [InputItemServiceAsync.list]. */ - @MustBeClosed fun list(responseId: String): CompletableFuture> = list(responseId, InputItemListParams.none()) /** @see [list] */ - @MustBeClosed fun list( responseId: String, params: InputItemListParams = InputItemListParams.none(), @@ -74,7 +71,6 @@ interface InputItemServiceAsync { list(params.toBuilder().responseId(responseId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( responseId: String, params: InputItemListParams = InputItemListParams.none(), @@ -82,21 +78,18 @@ interface InputItemServiceAsync { list(responseId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: InputItemListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list( params: InputItemListParams ): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( responseId: String, requestOptions: RequestOptions, diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/uploads/PartServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/uploads/PartServiceAsync.kt index 7961d9b6..2d433f99 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/uploads/PartServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/uploads/PartServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.uploads -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.uploads.parts.PartCreateParams @@ -56,7 +55,6 @@ interface PartServiceAsync { * Returns a raw HTTP response for `post /uploads/{upload_id}/parts`, but is otherwise the * same as [PartServiceAsync.create]. */ - @MustBeClosed fun create( uploadId: String, params: PartCreateParams, @@ -64,7 +62,6 @@ interface PartServiceAsync { create(uploadId, params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( uploadId: String, params: PartCreateParams, @@ -73,12 +70,10 @@ interface PartServiceAsync { create(params.toBuilder().uploadId(uploadId).build(), requestOptions) /** @see [create] */ - @MustBeClosed fun create(params: PartCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: PartCreateParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileBatchServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileBatchServiceAsync.kt index df0a4a2d..d2b5adf0 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileBatchServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileBatchServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.vectorstores -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.vectorstores.filebatches.FileBatchCancelParams @@ -131,7 +130,6 @@ interface FileBatchServiceAsync { * Returns a raw HTTP response for `post /vector_stores/{vector_store_id}/file_batches`, but * is otherwise the same as [FileBatchServiceAsync.create]. */ - @MustBeClosed fun create( vectorStoreId: String, params: FileBatchCreateParams, @@ -139,7 +137,6 @@ interface FileBatchServiceAsync { create(vectorStoreId, params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( vectorStoreId: String, params: FileBatchCreateParams, @@ -148,14 +145,12 @@ interface FileBatchServiceAsync { create(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [create] */ - @MustBeClosed fun create( params: FileBatchCreateParams ): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: FileBatchCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -166,7 +161,6 @@ interface FileBatchServiceAsync { * /vector_stores/{vector_store_id}/file_batches/{batch_id}`, but is otherwise the same as * [FileBatchServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( batchId: String, params: FileBatchRetrieveParams, @@ -174,7 +168,6 @@ interface FileBatchServiceAsync { retrieve(batchId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( batchId: String, params: FileBatchRetrieveParams, @@ -183,14 +176,12 @@ interface FileBatchServiceAsync { retrieve(params.toBuilder().batchId(batchId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileBatchRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileBatchRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -201,7 +192,6 @@ interface FileBatchServiceAsync { * /vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel`, but is otherwise the * same as [FileBatchServiceAsync.cancel]. */ - @MustBeClosed fun cancel( batchId: String, params: FileBatchCancelParams, @@ -209,7 +199,6 @@ interface FileBatchServiceAsync { cancel(batchId, params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( batchId: String, params: FileBatchCancelParams, @@ -218,14 +207,12 @@ interface FileBatchServiceAsync { cancel(params.toBuilder().batchId(batchId).build(), requestOptions) /** @see [cancel] */ - @MustBeClosed fun cancel( params: FileBatchCancelParams ): CompletableFuture> = cancel(params, RequestOptions.none()) /** @see [cancel] */ - @MustBeClosed fun cancel( params: FileBatchCancelParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -236,7 +223,6 @@ interface FileBatchServiceAsync { * /vector_stores/{vector_store_id}/file_batches/{batch_id}/files`, but is otherwise the * same as [FileBatchServiceAsync.listFiles]. */ - @MustBeClosed fun listFiles( batchId: String, params: FileBatchListFilesParams, @@ -244,7 +230,6 @@ interface FileBatchServiceAsync { listFiles(batchId, params, RequestOptions.none()) /** @see [listFiles] */ - @MustBeClosed fun listFiles( batchId: String, params: FileBatchListFilesParams, @@ -253,14 +238,12 @@ interface FileBatchServiceAsync { listFiles(params.toBuilder().batchId(batchId).build(), requestOptions) /** @see [listFiles] */ - @MustBeClosed fun listFiles( params: FileBatchListFilesParams ): CompletableFuture> = listFiles(params, RequestOptions.none()) /** @see [listFiles] */ - @MustBeClosed fun listFiles( params: FileBatchListFilesParams, requestOptions: RequestOptions = RequestOptions.none(), diff --git a/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileServiceAsync.kt b/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileServiceAsync.kt index bc0b1e49..b4dd00c2 100644 --- a/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileServiceAsync.kt +++ b/openai-java-core/src/main/kotlin/com/openai/services/async/vectorstores/FileServiceAsync.kt @@ -2,7 +2,6 @@ package com.openai.services.async.vectorstores -import com.google.errorprone.annotations.MustBeClosed import com.openai.core.RequestOptions import com.openai.core.http.HttpResponseFor import com.openai.models.vectorstores.files.FileContentPageAsync @@ -190,7 +189,6 @@ interface FileServiceAsync { * Returns a raw HTTP response for `post /vector_stores/{vector_store_id}/files`, but is * otherwise the same as [FileServiceAsync.create]. */ - @MustBeClosed fun create( vectorStoreId: String, params: FileCreateParams, @@ -198,7 +196,6 @@ interface FileServiceAsync { create(vectorStoreId, params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( vectorStoreId: String, params: FileCreateParams, @@ -207,12 +204,10 @@ interface FileServiceAsync { create(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [create] */ - @MustBeClosed fun create(params: FileCreateParams): CompletableFuture> = create(params, RequestOptions.none()) /** @see [create] */ - @MustBeClosed fun create( params: FileCreateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -222,7 +217,6 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /vector_stores/{vector_store_id}/files/{file_id}`, * but is otherwise the same as [FileServiceAsync.retrieve]. */ - @MustBeClosed fun retrieve( fileId: String, params: FileRetrieveParams, @@ -230,7 +224,6 @@ interface FileServiceAsync { retrieve(fileId, params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( fileId: String, params: FileRetrieveParams, @@ -239,14 +232,12 @@ interface FileServiceAsync { retrieve(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileRetrieveParams ): CompletableFuture> = retrieve(params, RequestOptions.none()) /** @see [retrieve] */ - @MustBeClosed fun retrieve( params: FileRetrieveParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -256,7 +247,6 @@ interface FileServiceAsync { * Returns a raw HTTP response for `post /vector_stores/{vector_store_id}/files/{file_id}`, * but is otherwise the same as [FileServiceAsync.update]. */ - @MustBeClosed fun update( fileId: String, params: FileUpdateParams, @@ -264,7 +254,6 @@ interface FileServiceAsync { update(fileId, params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( fileId: String, params: FileUpdateParams, @@ -273,12 +262,10 @@ interface FileServiceAsync { update(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [update] */ - @MustBeClosed fun update(params: FileUpdateParams): CompletableFuture> = update(params, RequestOptions.none()) /** @see [update] */ - @MustBeClosed fun update( params: FileUpdateParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -288,12 +275,10 @@ interface FileServiceAsync { * Returns a raw HTTP response for `get /vector_stores/{vector_store_id}/files`, but is * otherwise the same as [FileServiceAsync.list]. */ - @MustBeClosed fun list(vectorStoreId: String): CompletableFuture> = list(vectorStoreId, FileListParams.none()) /** @see [list] */ - @MustBeClosed fun list( vectorStoreId: String, params: FileListParams = FileListParams.none(), @@ -302,7 +287,6 @@ interface FileServiceAsync { list(params.toBuilder().vectorStoreId(vectorStoreId).build(), requestOptions) /** @see [list] */ - @MustBeClosed fun list( vectorStoreId: String, params: FileListParams = FileListParams.none(), @@ -310,19 +294,16 @@ interface FileServiceAsync { list(vectorStoreId, params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( params: FileListParams, requestOptions: RequestOptions = RequestOptions.none(), ): CompletableFuture> /** @see [list] */ - @MustBeClosed fun list(params: FileListParams): CompletableFuture> = list(params, RequestOptions.none()) /** @see [list] */ - @MustBeClosed fun list( vectorStoreId: String, requestOptions: RequestOptions, @@ -334,7 +315,6 @@ interface FileServiceAsync { * /vector_stores/{vector_store_id}/files/{file_id}`, but is otherwise the same as * [FileServiceAsync.delete]. */ - @MustBeClosed fun delete( fileId: String, params: FileDeleteParams, @@ -342,7 +322,6 @@ interface FileServiceAsync { delete(fileId, params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( fileId: String, params: FileDeleteParams, @@ -351,14 +330,12 @@ interface FileServiceAsync { delete(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [delete] */ - @MustBeClosed fun delete( params: FileDeleteParams ): CompletableFuture> = delete(params, RequestOptions.none()) /** @see [delete] */ - @MustBeClosed fun delete( params: FileDeleteParams, requestOptions: RequestOptions = RequestOptions.none(), @@ -369,7 +346,6 @@ interface FileServiceAsync { * /vector_stores/{vector_store_id}/files/{file_id}/content`, but is otherwise the same as * [FileServiceAsync.content]. */ - @MustBeClosed fun content( fileId: String, params: FileContentParams, @@ -377,7 +353,6 @@ interface FileServiceAsync { content(fileId, params, RequestOptions.none()) /** @see [content] */ - @MustBeClosed fun content( fileId: String, params: FileContentParams, @@ -386,14 +361,12 @@ interface FileServiceAsync { content(params.toBuilder().fileId(fileId).build(), requestOptions) /** @see [content] */ - @MustBeClosed fun content( params: FileContentParams ): CompletableFuture> = content(params, RequestOptions.none()) /** @see [content] */ - @MustBeClosed fun content( params: FileContentParams, requestOptions: RequestOptions = RequestOptions.none(), From b668bf8ea5a3539c2f51bd8b46b3af1d8b17abf9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 29 May 2025 05:04:58 +0000 Subject: [PATCH 8/8] release: 2.3.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 17 +++++++++++++++++ README.md | 10 +++++----- build.gradle.kts | 2 +- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 89d8ff81..75ec52fc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.2.1" + ".": "2.3.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d2dcf3f9..27bc5ecf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 2.3.0 (2025-05-29) + +Full Changelog: [v2.2.1...v2.3.0](https://github.com/openai/openai-java/compare/v2.2.1...v2.3.0) + +### Features + +* **api:** Config update for pakrym-stream-param ([55ae767](https://github.com/openai/openai-java/commit/55ae767021a1d03a2c8bc4184163acd56ee64d41)) + + +### Bug Fixes + +* **client:** add missing deployment model param ([#704](https://github.com/openai/openai-java/issues/704)) ([37aa563](https://github.com/openai/openai-java/commit/37aa563789f34de917758519d859f17d9c1a98fc)) +* **client:** correctly send streaming discriminator param ([b27559f](https://github.com/openai/openai-java/commit/b27559fa7d1c097ada40da12e55d1def372f5dce)) +* **client:** optional image deployment model param ([a507f84](https://github.com/openai/openai-java/commit/a507f8446a2270ee3e9c5e5295a9a57b59c633eb)) +* **client:** remove `@MustBeClosed` for future returning methods ([2988157](https://github.com/openai/openai-java/commit/2988157933dfe2ec7f9f2b626d0fa9eb184db27d)) +* **client:** return binary content from `get /containers/{container_id}/files/{file_id}/content` ([787e12b](https://github.com/openai/openai-java/commit/787e12b4ac3d33f46aa31c165241c26f927e92dc)) + ## 2.2.1 (2025-05-27) Full Changelog: [v2.2.0...v2.2.1](https://github.com/openai/openai-java/compare/v2.2.0...v2.2.1) diff --git a/README.md b/README.md index 411b0949..f5caddb7 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ -[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/2.2.1) -[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/2.2.1/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/2.2.1) +[![Maven Central](https://img.shields.io/maven-central/v/com.openai/openai-java)](https://central.sonatype.com/artifact/com.openai/openai-java/2.3.0) +[![javadoc](https://javadoc.io/badge2/com.openai/openai-java/2.3.0/javadoc.svg)](https://javadoc.io/doc/com.openai/openai-java/2.3.0) @@ -11,7 +11,7 @@ The OpenAI Java SDK provides convenient access to the [OpenAI REST API](https:// -The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/2.2.1). +The REST API documentation can be found on [platform.openai.com](https://platform.openai.com/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.openai/openai-java/2.3.0). @@ -22,7 +22,7 @@ The REST API documentation can be found on [platform.openai.com](https://platfor ### Gradle ```kotlin -implementation("com.openai:openai-java:2.2.1") +implementation("com.openai:openai-java:2.3.0") ``` ### Maven @@ -31,7 +31,7 @@ implementation("com.openai:openai-java:2.2.1") com.openai openai-java - 2.2.1 + 2.3.0 ``` diff --git a/build.gradle.kts b/build.gradle.kts index cbf7d4ab..fb9792f5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ repositories { allprojects { group = "com.openai" - version = "2.2.1" // x-release-please-version + version = "2.3.0" // x-release-please-version } subprojects {