Skip to content

Commit

Permalink
feat(api): updates
Browse files Browse the repository at this point in the history
chore: unknown commit message
  • Loading branch information
stainless-bot authored and Stainless Bot committed Aug 6, 2024
1 parent dce0b9e commit c818fda
Show file tree
Hide file tree
Showing 27 changed files with 2,215 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 20
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-b04761ffd2adad3cc19a6dc6fc696ac445878219972f891881a967340fa9a6b0.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-4097c2f86beb3f3bb021775cd1dfa240e960caf842aeefc2e08da4dc0851ea79.yml
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ private constructor(
class Logprobs
private constructor(
private val content: JsonField<List<ChatCompletionTokenLogprob>>,
private val refusal: JsonField<List<ChatCompletionTokenLogprob>>,
private val additionalProperties: Map<String, JsonValue>,
) {

Expand All @@ -586,16 +587,24 @@ private constructor(
fun content(): Optional<List<ChatCompletionTokenLogprob>> =
Optional.ofNullable(content.getNullable("content"))

/** A list of message refusal tokens with log probability information. */
fun refusal(): Optional<List<ChatCompletionTokenLogprob>> =
Optional.ofNullable(refusal.getNullable("refusal"))

/** A list of message content tokens with log probability information. */
@JsonProperty("content") @ExcludeMissing fun _content() = content

/** A list of message refusal tokens with log probability information. */
@JsonProperty("refusal") @ExcludeMissing fun _refusal() = refusal

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

fun validate(): Logprobs = apply {
if (!validated) {
content().map { it.forEach { it.validate() } }
refusal().map { it.forEach { it.validate() } }
validated = true
}
}
Expand All @@ -609,18 +618,24 @@ private constructor(

return other is Logprobs &&
this.content == other.content &&
this.refusal == other.refusal &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = Objects.hash(content, additionalProperties)
hashCode =
Objects.hash(
content,
refusal,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"Logprobs{content=$content, additionalProperties=$additionalProperties}"
"Logprobs{content=$content, refusal=$refusal, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -630,11 +645,13 @@ private constructor(
class Builder {

private var content: JsonField<List<ChatCompletionTokenLogprob>> = JsonMissing.of()
private var refusal: JsonField<List<ChatCompletionTokenLogprob>> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(logprobs: Logprobs) = apply {
this.content = logprobs.content
this.refusal = logprobs.refusal
additionalProperties(logprobs.additionalProperties)
}

Expand All @@ -649,6 +666,17 @@ private constructor(
this.content = content
}

/** A list of message refusal tokens with log probability information. */
fun refusal(refusal: List<ChatCompletionTokenLogprob>) =
refusal(JsonField.of(refusal))

/** A list of message refusal tokens with log probability information. */
@JsonProperty("refusal")
@ExcludeMissing
fun refusal(refusal: JsonField<List<ChatCompletionTokenLogprob>>) = apply {
this.refusal = refusal
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
Expand All @@ -667,7 +695,8 @@ private constructor(
fun build(): Logprobs =
Logprobs(
content.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable()
refusal.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
)
}
}
Expand Down
Loading

0 comments on commit c818fda

Please sign in to comment.