From c60d81b1c42f8b05166ae0cc92c33709ac6563c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 Nov 2024 21:36:19 +0000 Subject: [PATCH] chore: rebuild project due to codegen change (#4) --- .../api/models/ChatCompletionCreateParams.kt | 79 ++++++++++--------- .../api/models/CompletionCreateParams.kt | 79 ++++++++++--------- 2 files changed, 86 insertions(+), 72 deletions(-) diff --git a/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/ChatCompletionCreateParams.kt b/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/ChatCompletionCreateParams.kt index 46c9a20..465586f 100644 --- a/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/ChatCompletionCreateParams.kt +++ b/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/ChatCompletionCreateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.omnistack.api.core.BaseDeserializer import com.omnistack.api.core.BaseSerializer import com.omnistack.api.core.Enum @@ -53,8 +55,8 @@ constructor( private val topLogprobs: Long?, private val topP: Double?, private val user: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -136,10 +138,10 @@ constructor( ) } - internal fun getQueryParams(): Map> = additionalQueryParams - internal fun getHeaders(): Map> = additionalHeaders + internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = ChatCompletionCreateBody.Builder::class) @NoAutoDetect class ChatCompletionCreateBody @@ -758,10 +760,10 @@ constructor( "ChatCompletionCreateBody{messages=$messages, model=$model, frequencyPenalty=$frequencyPenalty, functionCall=$functionCall, functions=$functions, logitBias=$logitBias, logprobs=$logprobs, maxCompletionTokens=$maxCompletionTokens, maxTokens=$maxTokens, n=$n, parallelToolCalls=$parallelToolCalls, presencePenalty=$presencePenalty, responseFormat=$responseFormat, seed=$seed, serviceTier=$serviceTier, stop=$stop, stream=$stream, streamOptions=$streamOptions, temperature=$temperature, toolChoice=$toolChoice, tools=$tools, topLogprobs=$topLogprobs, topP=$topP, user=$user, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -769,15 +771,15 @@ constructor( return true } - return /* spotless:off */ other is ChatCompletionCreateParams && this.messages == other.messages && this.model == other.model && this.frequencyPenalty == other.frequencyPenalty && this.functionCall == other.functionCall && this.functions == other.functions && this.logitBias == other.logitBias && this.logprobs == other.logprobs && this.maxCompletionTokens == other.maxCompletionTokens && this.maxTokens == other.maxTokens && this.n == other.n && this.parallelToolCalls == other.parallelToolCalls && this.presencePenalty == other.presencePenalty && this.responseFormat == other.responseFormat && this.seed == other.seed && this.serviceTier == other.serviceTier && this.stop == other.stop && this.stream == other.stream && this.streamOptions == other.streamOptions && this.temperature == other.temperature && this.toolChoice == other.toolChoice && this.tools == other.tools && this.topLogprobs == other.topLogprobs && this.topP == other.topP && this.user == other.user && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is ChatCompletionCreateParams && this.messages == other.messages && this.model == other.model && this.frequencyPenalty == other.frequencyPenalty && this.functionCall == other.functionCall && this.functions == other.functions && this.logitBias == other.logitBias && this.logprobs == other.logprobs && this.maxCompletionTokens == other.maxCompletionTokens && this.maxTokens == other.maxTokens && this.n == other.n && this.parallelToolCalls == other.parallelToolCalls && this.presencePenalty == other.presencePenalty && this.responseFormat == other.responseFormat && this.seed == other.seed && this.serviceTier == other.serviceTier && this.stop == other.stop && this.stream == other.stream && this.streamOptions == other.streamOptions && this.temperature == other.temperature && this.toolChoice == other.toolChoice && this.tools == other.tools && this.topLogprobs == other.topLogprobs && this.topP == other.topP && this.user == other.user && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(messages, model, frequencyPenalty, functionCall, functions, logitBias, logprobs, maxCompletionTokens, maxTokens, n, parallelToolCalls, presencePenalty, responseFormat, seed, serviceTier, stop, stream, streamOptions, temperature, toolChoice, tools, topLogprobs, topP, user, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(messages, model, frequencyPenalty, functionCall, functions, logitBias, logprobs, maxCompletionTokens, maxTokens, n, parallelToolCalls, presencePenalty, responseFormat, seed, serviceTier, stop, stream, streamOptions, temperature, toolChoice, tools, topLogprobs, topP, user, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "ChatCompletionCreateParams{messages=$messages, model=$model, frequencyPenalty=$frequencyPenalty, functionCall=$functionCall, functions=$functions, logitBias=$logitBias, logprobs=$logprobs, maxCompletionTokens=$maxCompletionTokens, maxTokens=$maxTokens, n=$n, parallelToolCalls=$parallelToolCalls, presencePenalty=$presencePenalty, responseFormat=$responseFormat, seed=$seed, serviceTier=$serviceTier, stop=$stop, stream=$stream, streamOptions=$streamOptions, temperature=$temperature, toolChoice=$toolChoice, tools=$tools, topLogprobs=$topLogprobs, topP=$topP, user=$user, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "ChatCompletionCreateParams{messages=$messages, model=$model, frequencyPenalty=$frequencyPenalty, functionCall=$functionCall, functions=$functions, logitBias=$logitBias, logprobs=$logprobs, maxCompletionTokens=$maxCompletionTokens, maxTokens=$maxTokens, n=$n, parallelToolCalls=$parallelToolCalls, presencePenalty=$presencePenalty, responseFormat=$responseFormat, seed=$seed, serviceTier=$serviceTier, stop=$stop, stream=$stream, streamOptions=$streamOptions, temperature=$temperature, toolChoice=$toolChoice, tools=$tools, topLogprobs=$topLogprobs, topP=$topP, user=$user, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -813,8 +815,8 @@ constructor( private var topLogprobs: Long? = null private var topP: Double? = null private var user: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() internal fun from(chatCompletionCreateParams: ChatCompletionCreateParams) = apply { @@ -842,8 +844,8 @@ constructor( this.topLogprobs = chatCompletionCreateParams.topLogprobs this.topP = chatCompletionCreateParams.topP this.user = chatCompletionCreateParams.user - additionalQueryParams(chatCompletionCreateParams.additionalQueryParams) additionalHeaders(chatCompletionCreateParams.additionalHeaders) + additionalQueryParams(chatCompletionCreateParams.additionalQueryParams) additionalBodyProperties(chatCompletionCreateParams.additionalBodyProperties) } @@ -1259,45 +1261,44 @@ constructor( */ fun user(user: String) = apply { this.user = user } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } + fun removeAdditionalHeader(name: String) = apply { additionalHeaders.removeAll(name) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAdditionalQueryParam(key: String) = apply { additionalQueryParams.removeAll(key) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -1339,8 +1340,14 @@ constructor( topLogprobs, topP, user, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) } diff --git a/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/CompletionCreateParams.kt b/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/CompletionCreateParams.kt index 8117a42..01d1cf8 100644 --- a/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/CompletionCreateParams.kt +++ b/omnistack-kotlin-core/src/main/kotlin/com/omnistack/api/models/CompletionCreateParams.kt @@ -13,6 +13,8 @@ import com.fasterxml.jackson.databind.SerializerProvider import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonSerialize import com.fasterxml.jackson.module.kotlin.jacksonTypeRef +import com.google.common.collect.ArrayListMultimap +import com.google.common.collect.ListMultimap import com.omnistack.api.core.BaseDeserializer import com.omnistack.api.core.BaseSerializer import com.omnistack.api.core.Enum @@ -46,8 +48,8 @@ constructor( private val temperature: Double?, private val topP: Double?, private val user: String?, - private val additionalQueryParams: Map>, private val additionalHeaders: Map>, + private val additionalQueryParams: Map>, private val additionalBodyProperties: Map, ) { @@ -111,10 +113,10 @@ constructor( ) } - internal fun getQueryParams(): Map> = additionalQueryParams - internal fun getHeaders(): Map> = additionalHeaders + internal fun getQueryParams(): Map> = additionalQueryParams + @JsonDeserialize(builder = CompletionCreateBody.Builder::class) @NoAutoDetect class CompletionCreateBody @@ -577,10 +579,10 @@ constructor( "CompletionCreateBody{model=$model, prompt=$prompt, bestOf=$bestOf, echo=$echo, frequencyPenalty=$frequencyPenalty, logitBias=$logitBias, logprobs=$logprobs, maxTokens=$maxTokens, n=$n, presencePenalty=$presencePenalty, seed=$seed, stop=$stop, stream=$stream, streamOptions=$streamOptions, suffix=$suffix, temperature=$temperature, topP=$topP, user=$user, additionalProperties=$additionalProperties}" } - fun _additionalQueryParams(): Map> = additionalQueryParams - fun _additionalHeaders(): Map> = additionalHeaders + fun _additionalQueryParams(): Map> = additionalQueryParams + fun _additionalBodyProperties(): Map = additionalBodyProperties override fun equals(other: Any?): Boolean { @@ -588,15 +590,15 @@ constructor( return true } - return /* spotless:off */ other is CompletionCreateParams && this.model == other.model && this.prompt == other.prompt && this.bestOf == other.bestOf && this.echo == other.echo && this.frequencyPenalty == other.frequencyPenalty && this.logitBias == other.logitBias && this.logprobs == other.logprobs && this.maxTokens == other.maxTokens && this.n == other.n && this.presencePenalty == other.presencePenalty && this.seed == other.seed && this.stop == other.stop && this.stream == other.stream && this.streamOptions == other.streamOptions && this.suffix == other.suffix && this.temperature == other.temperature && this.topP == other.topP && this.user == other.user && this.additionalQueryParams == other.additionalQueryParams && this.additionalHeaders == other.additionalHeaders && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ + return /* spotless:off */ other is CompletionCreateParams && this.model == other.model && this.prompt == other.prompt && this.bestOf == other.bestOf && this.echo == other.echo && this.frequencyPenalty == other.frequencyPenalty && this.logitBias == other.logitBias && this.logprobs == other.logprobs && this.maxTokens == other.maxTokens && this.n == other.n && this.presencePenalty == other.presencePenalty && this.seed == other.seed && this.stop == other.stop && this.stream == other.stream && this.streamOptions == other.streamOptions && this.suffix == other.suffix && this.temperature == other.temperature && this.topP == other.topP && this.user == other.user && this.additionalHeaders == other.additionalHeaders && this.additionalQueryParams == other.additionalQueryParams && this.additionalBodyProperties == other.additionalBodyProperties /* spotless:on */ } override fun hashCode(): Int { - return /* spotless:off */ Objects.hash(model, prompt, bestOf, echo, frequencyPenalty, logitBias, logprobs, maxTokens, n, presencePenalty, seed, stop, stream, streamOptions, suffix, temperature, topP, user, additionalQueryParams, additionalHeaders, additionalBodyProperties) /* spotless:on */ + return /* spotless:off */ Objects.hash(model, prompt, bestOf, echo, frequencyPenalty, logitBias, logprobs, maxTokens, n, presencePenalty, seed, stop, stream, streamOptions, suffix, temperature, topP, user, additionalHeaders, additionalQueryParams, additionalBodyProperties) /* spotless:on */ } override fun toString() = - "CompletionCreateParams{model=$model, prompt=$prompt, bestOf=$bestOf, echo=$echo, frequencyPenalty=$frequencyPenalty, logitBias=$logitBias, logprobs=$logprobs, maxTokens=$maxTokens, n=$n, presencePenalty=$presencePenalty, seed=$seed, stop=$stop, stream=$stream, streamOptions=$streamOptions, suffix=$suffix, temperature=$temperature, topP=$topP, user=$user, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}" + "CompletionCreateParams{model=$model, prompt=$prompt, bestOf=$bestOf, echo=$echo, frequencyPenalty=$frequencyPenalty, logitBias=$logitBias, logprobs=$logprobs, maxTokens=$maxTokens, n=$n, presencePenalty=$presencePenalty, seed=$seed, stop=$stop, stream=$stream, streamOptions=$streamOptions, suffix=$suffix, temperature=$temperature, topP=$topP, user=$user, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" fun toBuilder() = Builder().from(this) @@ -626,8 +628,8 @@ constructor( private var temperature: Double? = null private var topP: Double? = null private var user: String? = null - private var additionalQueryParams: MutableMap> = mutableMapOf() - private var additionalHeaders: MutableMap> = mutableMapOf() + private var additionalHeaders: ListMultimap = ArrayListMultimap.create() + private var additionalQueryParams: ListMultimap = ArrayListMultimap.create() private var additionalBodyProperties: MutableMap = mutableMapOf() internal fun from(completionCreateParams: CompletionCreateParams) = apply { @@ -649,8 +651,8 @@ constructor( this.temperature = completionCreateParams.temperature this.topP = completionCreateParams.topP this.user = completionCreateParams.user - additionalQueryParams(completionCreateParams.additionalQueryParams) additionalHeaders(completionCreateParams.additionalHeaders) + additionalQueryParams(completionCreateParams.additionalQueryParams) additionalBodyProperties(completionCreateParams.additionalBodyProperties) } @@ -884,45 +886,44 @@ constructor( */ fun user(user: String) = apply { this.user = user } - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllQueryParams(additionalQueryParams) + fun additionalHeaders(additionalHeaders: Map>) = apply { + this.additionalHeaders.clear() + putAllAdditionalHeaders(additionalHeaders) } - fun putQueryParam(name: String, value: String) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalHeader(name: String, value: String) = apply { + additionalHeaders.put(name, value) } - fun putQueryParams(name: String, values: Iterable) = apply { - this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalHeaders(name: String, values: Iterable) = apply { + additionalHeaders.putAll(name, values) } - fun putAllQueryParams(additionalQueryParams: Map>) = apply { - additionalQueryParams.forEach(this::putQueryParams) + fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { + additionalHeaders.forEach(::putAdditionalHeaders) } - fun removeQueryParam(name: String) = apply { - this.additionalQueryParams.put(name, mutableListOf()) - } + fun removeAdditionalHeader(name: String) = apply { additionalHeaders.removeAll(name) } - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllHeaders(additionalHeaders) + fun additionalQueryParams(additionalQueryParams: Map>) = apply { + this.additionalQueryParams.clear() + putAllAdditionalQueryParams(additionalQueryParams) } - fun putHeader(name: String, value: String) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value) + fun putAdditionalQueryParam(key: String, value: String) = apply { + additionalQueryParams.put(key, value) } - fun putHeaders(name: String, values: Iterable) = apply { - this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values) + fun putAdditionalQueryParams(key: String, values: Iterable) = apply { + additionalQueryParams.putAll(key, values) } - fun putAllHeaders(additionalHeaders: Map>) = apply { - additionalHeaders.forEach(this::putHeaders) - } + fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = + apply { + additionalQueryParams.forEach(::putAdditionalQueryParams) + } - fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) } + fun removeAdditionalQueryParam(key: String) = apply { additionalQueryParams.removeAll(key) } fun additionalBodyProperties(additionalBodyProperties: Map) = apply { this.additionalBodyProperties.clear() @@ -958,8 +959,14 @@ constructor( temperature, topP, user, - additionalQueryParams.mapValues { it.value.toImmutable() }.toImmutable(), - additionalHeaders.mapValues { it.value.toImmutable() }.toImmutable(), + additionalHeaders + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), + additionalQueryParams + .asMap() + .mapValues { it.value.toList().toImmutable() } + .toImmutable(), additionalBodyProperties.toImmutable(), ) }