feat(api): api update

This commit is contained in:
stainless-app[bot]
2025-11-26 04:21:21 +00:00
parent b34ab9cc01
commit 7d07165ae8
133 changed files with 20884 additions and 1775 deletions
@@ -67,7 +67,11 @@ private constructor(
*/
fun enableReservations(): Optional<Boolean> = body.enableReservations()
fun _metadata(): JsonValue = body._metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = body.metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -148,6 +152,13 @@ private constructor(
*/
fun _enableReservations(): JsonField<Boolean> = body._enableReservations()
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _metadata(): JsonField<Metadata> = body._metadata()
/**
* Returns the raw JSON value of [numReviewersPerItem].
*
@@ -339,7 +350,19 @@ private constructor(
body.enableReservations(enableReservations)
}
fun metadata(metadata: JsonValue) = apply { body.metadata(metadata) }
fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
fun numReviewersPerItem(numReviewersPerItem: Long?) = apply {
body.numReviewersPerItem(numReviewersPerItem)
@@ -633,7 +656,7 @@ private constructor(
private val defaultDataset: JsonField<String>,
private val description: JsonField<String>,
private val enableReservations: JsonField<Boolean>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val numReviewersPerItem: JsonField<Long>,
private val reservationMinutes: JsonField<Long>,
private val rubricInstructions: JsonField<String>,
@@ -659,7 +682,9 @@ private constructor(
@JsonProperty("enable_reservations")
@ExcludeMissing
enableReservations: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("num_reviewers_per_item")
@ExcludeMissing
numReviewersPerItem: JsonField<Long> = JsonMissing.of(),
@@ -732,7 +757,11 @@ private constructor(
fun enableReservations(): Optional<Boolean> =
enableReservations.getOptional("enable_reservations")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -826,6 +855,13 @@ private constructor(
@ExcludeMissing
fun _enableReservations(): JsonField<Boolean> = enableReservations
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [numReviewersPerItem].
*
@@ -917,7 +953,7 @@ private constructor(
private var defaultDataset: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var enableReservations: JsonField<Boolean> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var numReviewersPerItem: JsonField<Long> = JsonMissing.of()
private var reservationMinutes: JsonField<Long> = JsonMissing.of()
private var rubricInstructions: JsonField<String> = JsonMissing.of()
@@ -1042,7 +1078,19 @@ private constructor(
this.enableReservations = enableReservations
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun numReviewersPerItem(numReviewersPerItem: Long?) =
numReviewersPerItem(JsonField.ofNullable(numReviewersPerItem))
@@ -1257,6 +1305,7 @@ private constructor(
defaultDataset()
description()
enableReservations()
metadata().ifPresent { it.validate() }
numReviewersPerItem()
reservationMinutes()
rubricInstructions()
@@ -1288,6 +1337,7 @@ private constructor(
(if (defaultDataset.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (enableReservations.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (numReviewersPerItem.asKnown().isPresent) 1 else 0) +
(if (reservationMinutes.asKnown().isPresent) 1 else 0) +
(if (rubricInstructions.asKnown().isPresent) 1 else 0) +
@@ -1342,6 +1392,105 @@ private constructor(
"Body{name=$name, id=$id, createdAt=$createdAt, defaultDataset=$defaultDataset, description=$description, enableReservations=$enableReservations, metadata=$metadata, numReviewersPerItem=$numReviewersPerItem, reservationMinutes=$reservationMinutes, rubricInstructions=$rubricInstructions, rubricItems=$rubricItems, sessionIds=$sessionIds, updatedAt=$updatedAt, additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -12,6 +12,7 @@ import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -32,7 +33,7 @@ private constructor(
private val defaultDataset: JsonField<String>,
private val description: JsonField<String>,
private val enableReservations: JsonField<Boolean>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val numReviewersPerItem: JsonField<Long>,
private val reservationMinutes: JsonField<Long>,
private val runRuleId: JsonField<String>,
@@ -62,7 +63,7 @@ private constructor(
@JsonProperty("enable_reservations")
@ExcludeMissing
enableReservations: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("num_reviewers_per_item")
@ExcludeMissing
numReviewersPerItem: JsonField<Long> = JsonMissing.of(),
@@ -152,7 +153,11 @@ private constructor(
fun enableReservations(): Optional<Boolean> =
enableReservations.getOptional("enable_reservations")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -255,6 +260,13 @@ private constructor(
@ExcludeMissing
fun _enableReservations(): JsonField<Boolean> = enableReservations
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [numReviewersPerItem].
*
@@ -342,7 +354,7 @@ private constructor(
private var defaultDataset: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var enableReservations: JsonField<Boolean> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var numReviewersPerItem: JsonField<Long> = JsonMissing.of()
private var reservationMinutes: JsonField<Long> = JsonMissing.of()
private var runRuleId: JsonField<String> = JsonMissing.of()
@@ -497,7 +509,19 @@ private constructor(
this.enableReservations = enableReservations
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun numReviewersPerItem(numReviewersPerItem: Long?) =
numReviewersPerItem(JsonField.ofNullable(numReviewersPerItem))
@@ -668,6 +692,7 @@ private constructor(
defaultDataset()
description()
enableReservations()
metadata().ifPresent { it.validate() }
numReviewersPerItem()
reservationMinutes()
runRuleId()
@@ -700,6 +725,7 @@ private constructor(
(if (defaultDataset.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (enableReservations.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (numReviewersPerItem.asKnown().isPresent) 1 else 0) +
(if (reservationMinutes.asKnown().isPresent) 1 else 0) +
(if (runRuleId.asKnown().isPresent) 1 else 0) +
@@ -835,6 +861,105 @@ private constructor(
override fun toString() = value.toString()
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -33,7 +33,7 @@ private constructor(
private val defaultDataset: JsonField<String>,
private val description: JsonField<String>,
private val enableReservations: JsonField<Boolean>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val numReviewersPerItem: JsonField<Long>,
private val reservationMinutes: JsonField<Long>,
private val rubricInstructions: JsonField<String>,
@@ -64,7 +64,7 @@ private constructor(
@JsonProperty("enable_reservations")
@ExcludeMissing
enableReservations: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("num_reviewers_per_item")
@ExcludeMissing
numReviewersPerItem: JsonField<Long> = JsonMissing.of(),
@@ -155,7 +155,11 @@ private constructor(
fun enableReservations(): Optional<Boolean> =
enableReservations.getOptional("enable_reservations")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -265,6 +269,13 @@ private constructor(
@ExcludeMissing
fun _enableReservations(): JsonField<Boolean> = enableReservations
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [numReviewersPerItem].
*
@@ -369,7 +380,7 @@ private constructor(
private var defaultDataset: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var enableReservations: JsonField<Boolean> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var numReviewersPerItem: JsonField<Long> = JsonMissing.of()
private var reservationMinutes: JsonField<Long> = JsonMissing.of()
private var rubricInstructions: JsonField<String> = JsonMissing.of()
@@ -514,7 +525,19 @@ private constructor(
this.enableReservations = enableReservations
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun numReviewersPerItem(numReviewersPerItem: Long?) =
numReviewersPerItem(JsonField.ofNullable(numReviewersPerItem))
@@ -734,6 +757,7 @@ private constructor(
defaultDataset()
description()
enableReservations()
metadata().ifPresent { it.validate() }
numReviewersPerItem()
reservationMinutes()
rubricInstructions()
@@ -767,6 +791,7 @@ private constructor(
(if (defaultDataset.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (enableReservations.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (numReviewersPerItem.asKnown().isPresent) 1 else 0) +
(if (reservationMinutes.asKnown().isPresent) 1 else 0) +
(if (rubricInstructions.asKnown().isPresent) 1 else 0) +
@@ -904,6 +929,105 @@ private constructor(
override fun toString() = value.toString()
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -12,6 +12,7 @@ import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -31,7 +32,7 @@ private constructor(
private val defaultDataset: JsonField<String>,
private val description: JsonField<String>,
private val enableReservations: JsonField<Boolean>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val numReviewersPerItem: JsonField<Long>,
private val reservationMinutes: JsonField<Long>,
private val runRuleId: JsonField<String>,
@@ -60,7 +61,7 @@ private constructor(
@JsonProperty("enable_reservations")
@ExcludeMissing
enableReservations: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("num_reviewers_per_item")
@ExcludeMissing
numReviewersPerItem: JsonField<Long> = JsonMissing.of(),
@@ -143,7 +144,11 @@ private constructor(
fun enableReservations(): Optional<Boolean> =
enableReservations.getOptional("enable_reservations")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -239,6 +244,13 @@ private constructor(
@ExcludeMissing
fun _enableReservations(): JsonField<Boolean> = enableReservations
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [numReviewersPerItem].
*
@@ -323,7 +335,7 @@ private constructor(
private var defaultDataset: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var enableReservations: JsonField<Boolean> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var numReviewersPerItem: JsonField<Long> = JsonMissing.of()
private var reservationMinutes: JsonField<Long> = JsonMissing.of()
private var runRuleId: JsonField<String> = JsonMissing.of()
@@ -462,7 +474,19 @@ private constructor(
this.enableReservations = enableReservations
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun numReviewersPerItem(numReviewersPerItem: Long?) =
numReviewersPerItem(JsonField.ofNullable(numReviewersPerItem))
@@ -630,6 +654,7 @@ private constructor(
defaultDataset()
description()
enableReservations()
metadata().ifPresent { it.validate() }
numReviewersPerItem()
reservationMinutes()
runRuleId()
@@ -661,6 +686,7 @@ private constructor(
(if (defaultDataset.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (enableReservations.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (numReviewersPerItem.asKnown().isPresent) 1 else 0) +
(if (reservationMinutes.asKnown().isPresent) 1 else 0) +
(if (runRuleId.asKnown().isPresent) 1 else 0) +
@@ -796,6 +822,105 @@ private constructor(
override fun toString() = value.toString()
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -280,8 +280,8 @@ private constructor(
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
/** Alias for calling [metadata] with `Metadata.ofJsonValue(jsonValue)`. */
fun metadata(jsonValue: JsonValue) = apply { body.metadata(jsonValue) }
/** Alias for calling [metadata] with `Metadata.ofUnionMember0(unionMember0)`. */
fun metadata(unionMember0: Metadata.UnionMember0) = apply { body.metadata(unionMember0) }
/** Alias for calling [metadata] with `Metadata.ofMissing(missing)`. */
fun metadata(missing: Missing) = apply { body.metadata(missing) }
@@ -856,8 +856,9 @@ private constructor(
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
/** Alias for calling [metadata] with `Metadata.ofJsonValue(jsonValue)`. */
fun metadata(jsonValue: JsonValue) = metadata(Metadata.ofJsonValue(jsonValue))
/** Alias for calling [metadata] with `Metadata.ofUnionMember0(unionMember0)`. */
fun metadata(unionMember0: Metadata.UnionMember0) =
metadata(Metadata.ofUnionMember0(unionMember0))
/** Alias for calling [metadata] with `Metadata.ofMissing(missing)`. */
fun metadata(missing: Missing) = metadata(Metadata.ofMissing(missing))
@@ -1118,20 +1119,20 @@ private constructor(
@JsonSerialize(using = Metadata.Serializer::class)
class Metadata
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val missing: Missing? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun missing(): Optional<Missing> = Optional.ofNullable(missing)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isMissing(): Boolean = missing != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asMissing(): Missing = missing.getOrThrow("missing")
@@ -1139,7 +1140,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
missing != null -> visitor.visitMissing(missing)
else -> visitor.unknown(_json)
}
@@ -1153,7 +1154,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitMissing(missing: Missing) {
missing.validate()
@@ -1181,7 +1184,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitMissing(missing: Missing) = missing.validity()
@@ -1194,14 +1198,16 @@ private constructor(
return true
}
return other is Metadata && jsonValue == other.jsonValue && missing == other.missing
return other is Metadata &&
unionMember0 == other.unionMember0 &&
missing == other.missing
}
override fun hashCode(): Int = Objects.hash(jsonValue, missing)
override fun hashCode(): Int = Objects.hash(unionMember0, missing)
override fun toString(): String =
when {
jsonValue != null -> "Metadata{jsonValue=$jsonValue}"
unionMember0 != null -> "Metadata{unionMember0=$unionMember0}"
missing != null -> "Metadata{missing=$missing}"
_json != null -> "Metadata{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Metadata")
@@ -1209,7 +1215,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Metadata(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Metadata(unionMember0 = unionMember0)
@JvmStatic fun ofMissing(missing: Missing) = Metadata(missing = missing)
}
@@ -1219,7 +1226,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitMissing(missing: Missing): T
@@ -1245,19 +1252,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Metadata(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Missing>())?.let {
Metadata(missing = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Metadata(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from boolean).
0 -> Metadata(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -1276,13 +1283,115 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.missing != null -> generator.writeObject(value.missing)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Metadata")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
@JsonDeserialize(using = NumReviewersPerItem.Deserializer::class)
@@ -25,7 +25,7 @@ class CommitManifestResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val commitHash: JsonField<String>,
private val manifest: JsonValue,
private val manifest: JsonField<Manifest>,
private val examples: JsonField<List<Example>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -35,7 +35,7 @@ private constructor(
@JsonProperty("commit_hash")
@ExcludeMissing
commitHash: JsonField<String> = JsonMissing.of(),
@JsonProperty("manifest") @ExcludeMissing manifest: JsonValue = JsonMissing.of(),
@JsonProperty("manifest") @ExcludeMissing manifest: JsonField<Manifest> = JsonMissing.of(),
@JsonProperty("examples")
@ExcludeMissing
examples: JsonField<List<Example>> = JsonMissing.of(),
@@ -47,7 +47,11 @@ private constructor(
*/
fun commitHash(): String = commitHash.getRequired("commit_hash")
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonValue = manifest
/**
* @throws LangChainInvalidDataException 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 manifest(): Manifest = manifest.getRequired("manifest")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -62,6 +66,13 @@ private constructor(
*/
@JsonProperty("commit_hash") @ExcludeMissing fun _commitHash(): JsonField<String> = commitHash
/**
* Returns the raw JSON value of [manifest].
*
* Unlike [manifest], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonField<Manifest> = manifest
/**
* Returns the raw JSON value of [examples].
*
@@ -99,7 +110,7 @@ private constructor(
class Builder internal constructor() {
private var commitHash: JsonField<String>? = null
private var manifest: JsonValue? = null
private var manifest: JsonField<Manifest>? = null
private var examples: JsonField<MutableList<Example>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -122,7 +133,16 @@ private constructor(
*/
fun commitHash(commitHash: JsonField<String>) = apply { this.commitHash = commitHash }
fun manifest(manifest: JsonValue) = apply { this.manifest = manifest }
fun manifest(manifest: Manifest) = manifest(JsonField.of(manifest))
/**
* Sets [Builder.manifest] to an arbitrary JSON value.
*
* You should usually call [Builder.manifest] with a well-typed [Manifest] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun manifest(manifest: JsonField<Manifest>) = apply { this.manifest = manifest }
fun examples(examples: List<Example>?) = examples(JsonField.ofNullable(examples))
@@ -201,6 +221,7 @@ private constructor(
}
commitHash()
manifest().validate()
examples().ifPresent { it.forEach { it.validate() } }
validated = true
}
@@ -221,16 +242,116 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (commitHash.asKnown().isPresent) 1 else 0) +
(manifest.asKnown().getOrNull()?.validity() ?: 0) +
(examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
class Manifest
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Manifest]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Manifest]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(manifest: Manifest) = apply {
additionalProperties = manifest.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Manifest].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Manifest = Manifest(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Manifest = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Manifest && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Manifest{additionalProperties=$additionalProperties}"
}
/** Response model for example runs */
class Example
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val id: JsonField<String>,
private val sessionId: JsonField<String>,
private val inputs: JsonValue,
private val outputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val outputs: JsonField<Outputs>,
private val startTime: JsonField<OffsetDateTime>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -241,8 +362,8 @@ private constructor(
@JsonProperty("session_id")
@ExcludeMissing
sessionId: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("start_time")
@ExcludeMissing
startTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -260,9 +381,17 @@ private constructor(
*/
fun sessionId(): String = sessionId.getRequired("session_id")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = inputs.getOptional("inputs")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -284,6 +413,20 @@ private constructor(
*/
@JsonProperty("session_id") @ExcludeMissing fun _sessionId(): JsonField<String> = sessionId
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [startTime].
*
@@ -324,8 +467,8 @@ private constructor(
private var id: JsonField<String>? = null
private var sessionId: JsonField<String>? = null
private var inputs: JsonValue = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var inputs: JsonField<Inputs> = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -361,9 +504,33 @@ private constructor(
*/
fun sessionId(sessionId: JsonField<String>) = apply { this.sessionId = sessionId }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs?) = inputs(JsonField.ofNullable(inputs))
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun startTime(startTime: OffsetDateTime?) = startTime(JsonField.ofNullable(startTime))
@@ -433,6 +600,8 @@ private constructor(
id()
sessionId()
inputs().ifPresent { it.validate() }
outputs().ifPresent { it.validate() }
startTime()
validated = true
}
@@ -455,8 +624,214 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (sessionId.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (startTime.asKnown().isPresent) 1 else 0)
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -47,7 +47,11 @@ private constructor(
fun repo(): Optional<String> = Optional.ofNullable(repo)
fun _manifest(): JsonValue = body._manifest()
/**
* @throws LangChainInvalidDataException 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 manifest(): Manifest = body.manifest()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -67,6 +71,13 @@ private constructor(
*/
fun skipWebhooks(): Optional<SkipWebhooks> = body.skipWebhooks()
/**
* Returns the raw JSON value of [manifest].
*
* Unlike [manifest], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _manifest(): JsonField<Manifest> = body._manifest()
/**
* Returns the raw JSON value of [exampleRunIds].
*
@@ -149,7 +160,16 @@ private constructor(
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
fun manifest(manifest: JsonValue) = apply { body.manifest(manifest) }
fun manifest(manifest: Manifest) = apply { body.manifest(manifest) }
/**
* Sets [Builder.manifest] to an arbitrary JSON value.
*
* You should usually call [Builder.manifest] with a well-typed [Manifest] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun manifest(manifest: JsonField<Manifest>) = apply { body.manifest(manifest) }
fun exampleRunIds(exampleRunIds: List<String>?) = apply {
body.exampleRunIds(exampleRunIds)
@@ -370,7 +390,7 @@ private constructor(
class Body
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val manifest: JsonValue,
private val manifest: JsonField<Manifest>,
private val exampleRunIds: JsonField<List<String>>,
private val parentCommit: JsonField<String>,
private val skipWebhooks: JsonField<SkipWebhooks>,
@@ -379,7 +399,9 @@ private constructor(
@JsonCreator
private constructor(
@JsonProperty("manifest") @ExcludeMissing manifest: JsonValue = JsonMissing.of(),
@JsonProperty("manifest")
@ExcludeMissing
manifest: JsonField<Manifest> = JsonMissing.of(),
@JsonProperty("example_run_ids")
@ExcludeMissing
exampleRunIds: JsonField<List<String>> = JsonMissing.of(),
@@ -391,7 +413,11 @@ private constructor(
skipWebhooks: JsonField<SkipWebhooks> = JsonMissing.of(),
) : this(manifest, exampleRunIds, parentCommit, skipWebhooks, mutableMapOf())
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonValue = manifest
/**
* @throws LangChainInvalidDataException 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 manifest(): Manifest = manifest.getRequired("manifest")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -411,6 +437,13 @@ private constructor(
*/
fun skipWebhooks(): Optional<SkipWebhooks> = skipWebhooks.getOptional("skip_webhooks")
/**
* Returns the raw JSON value of [manifest].
*
* Unlike [manifest], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonField<Manifest> = manifest
/**
* Returns the raw JSON value of [exampleRunIds].
*
@@ -469,7 +502,7 @@ private constructor(
/** A builder for [Body]. */
class Builder internal constructor() {
private var manifest: JsonValue? = null
private var manifest: JsonField<Manifest>? = null
private var exampleRunIds: JsonField<MutableList<String>>? = null
private var parentCommit: JsonField<String> = JsonMissing.of()
private var skipWebhooks: JsonField<SkipWebhooks> = JsonMissing.of()
@@ -484,7 +517,16 @@ private constructor(
additionalProperties = body.additionalProperties.toMutableMap()
}
fun manifest(manifest: JsonValue) = apply { this.manifest = manifest }
fun manifest(manifest: Manifest) = manifest(JsonField.of(manifest))
/**
* Sets [Builder.manifest] to an arbitrary JSON value.
*
* You should usually call [Builder.manifest] with a well-typed [Manifest] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun manifest(manifest: JsonField<Manifest>) = apply { this.manifest = manifest }
fun exampleRunIds(exampleRunIds: List<String>?) =
exampleRunIds(JsonField.ofNullable(exampleRunIds))
@@ -602,6 +644,7 @@ private constructor(
return@apply
}
manifest().validate()
exampleRunIds()
parentCommit()
skipWebhooks().ifPresent { it.validate() }
@@ -624,7 +667,8 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(exampleRunIds.asKnown().getOrNull()?.size ?: 0) +
(manifest.asKnown().getOrNull()?.validity() ?: 0) +
(exampleRunIds.asKnown().getOrNull()?.size ?: 0) +
(if (parentCommit.asKnown().isPresent) 1 else 0) +
(skipWebhooks.asKnown().getOrNull()?.validity() ?: 0)
@@ -651,6 +695,105 @@ private constructor(
"Body{manifest=$manifest, exampleRunIds=$exampleRunIds, parentCommit=$parentCommit, skipWebhooks=$skipWebhooks, additionalProperties=$additionalProperties}"
}
class Manifest
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Manifest]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Manifest]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(manifest: Manifest) = apply {
additionalProperties = manifest.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Manifest].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Manifest = Manifest(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Manifest = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Manifest && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Manifest{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = SkipWebhooks.Deserializer::class)
@JsonSerialize(using = SkipWebhooks.Serializer::class)
class SkipWebhooks
@@ -30,7 +30,7 @@ private constructor(
private val commitHash: JsonField<String>,
private val createdAt: JsonField<OffsetDateTime>,
private val exampleRunIds: JsonField<List<String>>,
private val manifest: JsonValue,
private val manifest: JsonField<Manifest>,
private val numDownloads: JsonField<Long>,
private val numViews: JsonField<Long>,
private val repoId: JsonField<String>,
@@ -53,7 +53,7 @@ private constructor(
@JsonProperty("example_run_ids")
@ExcludeMissing
exampleRunIds: JsonField<List<String>> = JsonMissing.of(),
@JsonProperty("manifest") @ExcludeMissing manifest: JsonValue = JsonMissing.of(),
@JsonProperty("manifest") @ExcludeMissing manifest: JsonField<Manifest> = JsonMissing.of(),
@JsonProperty("num_downloads")
@ExcludeMissing
numDownloads: JsonField<Long> = JsonMissing.of(),
@@ -107,7 +107,11 @@ private constructor(
*/
fun exampleRunIds(): List<String> = exampleRunIds.getRequired("example_run_ids")
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonValue = manifest
/**
* @throws LangChainInvalidDataException 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 manifest(): Manifest = manifest.getRequired("manifest")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -183,6 +187,13 @@ private constructor(
@ExcludeMissing
fun _exampleRunIds(): JsonField<List<String>> = exampleRunIds
/**
* Returns the raw JSON value of [manifest].
*
* Unlike [manifest], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonField<Manifest> = manifest
/**
* Returns the raw JSON value of [numDownloads].
*
@@ -279,7 +290,7 @@ private constructor(
private var commitHash: JsonField<String>? = null
private var createdAt: JsonField<OffsetDateTime>? = null
private var exampleRunIds: JsonField<MutableList<String>>? = null
private var manifest: JsonValue? = null
private var manifest: JsonField<Manifest>? = null
private var numDownloads: JsonField<Long>? = null
private var numViews: JsonField<Long>? = null
private var repoId: JsonField<String>? = null
@@ -363,7 +374,16 @@ private constructor(
}
}
fun manifest(manifest: JsonValue) = apply { this.manifest = manifest }
fun manifest(manifest: Manifest) = manifest(JsonField.of(manifest))
/**
* Sets [Builder.manifest] to an arbitrary JSON value.
*
* You should usually call [Builder.manifest] with a well-typed [Manifest] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun manifest(manifest: JsonField<Manifest>) = apply { this.manifest = manifest }
fun numDownloads(numDownloads: Long) = numDownloads(JsonField.of(numDownloads))
@@ -519,6 +539,7 @@ private constructor(
commitHash()
createdAt()
exampleRunIds()
manifest().validate()
numDownloads()
numViews()
repoId()
@@ -548,6 +569,7 @@ private constructor(
(if (commitHash.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(exampleRunIds.asKnown().getOrNull()?.size ?: 0) +
(manifest.asKnown().getOrNull()?.validity() ?: 0) +
(if (numDownloads.asKnown().isPresent) 1 else 0) +
(if (numViews.asKnown().isPresent) 1 else 0) +
(if (repoId.asKnown().isPresent) 1 else 0) +
@@ -556,6 +578,105 @@ private constructor(
(if (parentCommitHash.asKnown().isPresent) 1 else 0) +
(if (parentId.asKnown().isPresent) 1 else 0)
class Manifest
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Manifest]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Manifest]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(manifest: Manifest) = apply {
additionalProperties = manifest.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Manifest].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Manifest = Manifest(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Manifest = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Manifest && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Manifest{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -34,10 +34,10 @@ private constructor(
private val dataType: JsonField<DataType>,
private val description: JsonField<String>,
private val externallyManaged: JsonField<Boolean>,
private val inputsSchemaDefinition: JsonValue,
private val inputsSchemaDefinition: JsonField<InputsSchemaDefinition>,
private val lastSessionStartTime: JsonField<OffsetDateTime>,
private val metadata: JsonValue,
private val outputsSchemaDefinition: JsonValue,
private val metadata: JsonField<Metadata>,
private val outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>,
private val transformations: JsonField<List<DatasetTransformation>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -68,14 +68,14 @@ private constructor(
externallyManaged: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
inputsSchemaDefinition: JsonValue = JsonMissing.of(),
inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("last_session_start_time")
@ExcludeMissing
lastSessionStartTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
outputsSchemaDefinition: JsonValue = JsonMissing.of(),
outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("transformations")
@ExcludeMissing
transformations: JsonField<List<DatasetTransformation>> = JsonMissing.of(),
@@ -160,9 +160,12 @@ private constructor(
*/
fun externallyManaged(): Optional<Boolean> = externallyManaged.getOptional("externally_managed")
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonValue = inputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputsSchemaDefinition(): Optional<InputsSchemaDefinition> =
inputsSchemaDefinition.getOptional("inputs_schema_definition")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -171,11 +174,18 @@ private constructor(
fun lastSessionStartTime(): Optional<OffsetDateTime> =
lastSessionStartTime.getOptional("last_session_start_time")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonValue = outputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputsSchemaDefinition(): Optional<OutputsSchemaDefinition> =
outputsSchemaDefinition.getOptional("outputs_schema_definition")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -265,6 +275,16 @@ private constructor(
@ExcludeMissing
fun _externallyManaged(): JsonField<Boolean> = externallyManaged
/**
* Returns the raw JSON value of [inputsSchemaDefinition].
*
* Unlike [inputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonField<InputsSchemaDefinition> = inputsSchemaDefinition
/**
* Returns the raw JSON value of [lastSessionStartTime].
*
@@ -275,6 +295,23 @@ private constructor(
@ExcludeMissing
fun _lastSessionStartTime(): JsonField<OffsetDateTime> = lastSessionStartTime
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [outputsSchemaDefinition].
*
* Unlike [outputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonField<OutputsSchemaDefinition> = outputsSchemaDefinition
/**
* Returns the raw JSON value of [transformations].
*
@@ -327,10 +364,10 @@ private constructor(
private var dataType: JsonField<DataType> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var externallyManaged: JsonField<Boolean> = JsonMissing.of()
private var inputsSchemaDefinition: JsonValue = JsonMissing.of()
private var inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of()
private var lastSessionStartTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var outputsSchemaDefinition: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of()
private var transformations: JsonField<MutableList<DatasetTransformation>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -485,9 +522,27 @@ private constructor(
this.externallyManaged = externallyManaged
}
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonValue) = apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun inputsSchemaDefinition(inputsSchemaDefinition: InputsSchemaDefinition?) =
inputsSchemaDefinition(JsonField.ofNullable(inputsSchemaDefinition))
/**
* Alias for calling [Builder.inputsSchemaDefinition] with
* `inputsSchemaDefinition.orElse(null)`.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: Optional<InputsSchemaDefinition>) =
inputsSchemaDefinition(inputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.inputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.inputsSchemaDefinition] with a well-typed
* [InputsSchemaDefinition] value instead. This method is primarily for setting the field to
* an undocumented or not yet supported value.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonField<InputsSchemaDefinition>) =
apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun lastSessionStartTime(lastSessionStartTime: OffsetDateTime?) =
lastSessionStartTime(JsonField.ofNullable(lastSessionStartTime))
@@ -510,11 +565,41 @@ private constructor(
this.lastSessionStartTime = lastSessionStartTime
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonValue) = apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun outputsSchemaDefinition(outputsSchemaDefinition: OutputsSchemaDefinition?) =
outputsSchemaDefinition(JsonField.ofNullable(outputsSchemaDefinition))
/**
* Alias for calling [Builder.outputsSchemaDefinition] with
* `outputsSchemaDefinition.orElse(null)`.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: Optional<OutputsSchemaDefinition>) =
outputsSchemaDefinition(outputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.outputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.outputsSchemaDefinition] with a well-typed
* [OutputsSchemaDefinition] value instead. This method is primarily for setting the field
* to an undocumented or not yet supported value.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>) =
apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
fun transformations(transformations: List<DatasetTransformation>?) =
transformations(JsonField.ofNullable(transformations))
@@ -620,7 +705,10 @@ private constructor(
dataType().ifPresent { it.validate() }
description()
externallyManaged()
inputsSchemaDefinition().ifPresent { it.validate() }
lastSessionStartTime()
metadata().ifPresent { it.validate() }
outputsSchemaDefinition().ifPresent { it.validate() }
transformations().ifPresent { it.forEach { it.validate() } }
validated = true
}
@@ -650,9 +738,319 @@ private constructor(
(dataType.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (externallyManaged.asKnown().isPresent) 1 else 0) +
(inputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(if (lastSessionStartTime.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(transformations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
class InputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [InputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [InputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputsSchemaDefinition: InputsSchemaDefinition) = apply {
additionalProperties = inputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [InputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): InputsSchemaDefinition =
InputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): InputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is InputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"InputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class OutputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [OutputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [OutputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputsSchemaDefinition: OutputsSchemaDefinition) = apply {
additionalProperties = outputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [OutputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): OutputsSchemaDefinition =
OutputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): OutputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is OutputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"OutputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3,29 +3,23 @@
package com.langchain.smith.models.datasets
import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.langchain.smith.core.ExcludeMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Collections
import java.util.Objects
class DatasetCloneResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(private val additionalProperties: MutableMap<String, JsonValue>) {
@JsonCreator private constructor() : this(mutableMapOf())
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
}
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> =
Collections.unmodifiableMap(additionalProperties)
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
@@ -69,8 +63,7 @@ private constructor(private val additionalProperties: MutableMap<String, JsonVal
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): DatasetCloneResponse =
DatasetCloneResponse(additionalProperties.toMutableMap())
fun build(): DatasetCloneResponse = DatasetCloneResponse(additionalProperties.toImmutable())
}
private var validated: Boolean = false
@@ -96,7 +89,9 @@ private constructor(private val additionalProperties: MutableMap<String, JsonVal
*
* Used for best match union deserialization.
*/
@JvmSynthetic internal fun validity(): Int = 0
@JvmSynthetic
internal fun validity(): Int =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -69,11 +69,24 @@ private constructor(
*/
fun externallyManaged(): Optional<Boolean> = body.externallyManaged()
fun _extra(): JsonValue = body._extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = body.extra()
fun _inputsSchemaDefinition(): JsonValue = body._inputsSchemaDefinition()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputsSchemaDefinition(): Optional<InputsSchemaDefinition> = body.inputsSchemaDefinition()
fun _outputsSchemaDefinition(): JsonValue = body._outputsSchemaDefinition()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputsSchemaDefinition(): Optional<OutputsSchemaDefinition> =
body.outputsSchemaDefinition()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -124,6 +137,31 @@ private constructor(
*/
fun _externallyManaged(): JsonField<Boolean> = body._externallyManaged()
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _extra(): JsonField<Extra> = body._extra()
/**
* Returns the raw JSON value of [inputsSchemaDefinition].
*
* Unlike [inputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
fun _inputsSchemaDefinition(): JsonField<InputsSchemaDefinition> =
body._inputsSchemaDefinition()
/**
* Returns the raw JSON value of [outputsSchemaDefinition].
*
* Unlike [outputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
fun _outputsSchemaDefinition(): JsonField<OutputsSchemaDefinition> =
body._outputsSchemaDefinition()
/**
* Returns the raw JSON value of [transformations].
*
@@ -269,16 +307,65 @@ private constructor(
body.externallyManaged(externallyManaged)
}
fun extra(extra: JsonValue) = apply { body.extra(extra) }
fun extra(extra: Extra?) = apply { body.extra(extra) }
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonValue) = apply {
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { body.extra(extra) }
fun inputsSchemaDefinition(inputsSchemaDefinition: InputsSchemaDefinition?) = apply {
body.inputsSchemaDefinition(inputsSchemaDefinition)
}
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonValue) = apply {
/**
* Alias for calling [Builder.inputsSchemaDefinition] with
* `inputsSchemaDefinition.orElse(null)`.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: Optional<InputsSchemaDefinition>) =
inputsSchemaDefinition(inputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.inputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.inputsSchemaDefinition] with a well-typed
* [InputsSchemaDefinition] value instead. This method is primarily for setting the field to
* an undocumented or not yet supported value.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonField<InputsSchemaDefinition>) =
apply {
body.inputsSchemaDefinition(inputsSchemaDefinition)
}
fun outputsSchemaDefinition(outputsSchemaDefinition: OutputsSchemaDefinition?) = apply {
body.outputsSchemaDefinition(outputsSchemaDefinition)
}
/**
* Alias for calling [Builder.outputsSchemaDefinition] with
* `outputsSchemaDefinition.orElse(null)`.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: Optional<OutputsSchemaDefinition>) =
outputsSchemaDefinition(outputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.outputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.outputsSchemaDefinition] with a well-typed
* [OutputsSchemaDefinition] value instead. This method is primarily for setting the field
* to an undocumented or not yet supported value.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>) =
apply {
body.outputsSchemaDefinition(outputsSchemaDefinition)
}
fun transformations(transformations: List<DatasetTransformation>?) = apply {
body.transformations(transformations)
}
@@ -460,9 +547,9 @@ private constructor(
private val dataType: JsonField<DataType>,
private val description: JsonField<String>,
private val externallyManaged: JsonField<Boolean>,
private val extra: JsonValue,
private val inputsSchemaDefinition: JsonValue,
private val outputsSchemaDefinition: JsonValue,
private val extra: JsonField<Extra>,
private val inputsSchemaDefinition: JsonField<InputsSchemaDefinition>,
private val outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>,
private val transformations: JsonField<List<DatasetTransformation>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -483,13 +570,13 @@ private constructor(
@JsonProperty("externally_managed")
@ExcludeMissing
externallyManaged: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
inputsSchemaDefinition: JsonValue = JsonMissing.of(),
inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
outputsSchemaDefinition: JsonValue = JsonMissing.of(),
outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("transformations")
@ExcludeMissing
transformations: JsonField<List<DatasetTransformation>> = JsonMissing.of(),
@@ -546,15 +633,25 @@ private constructor(
fun externallyManaged(): Optional<Boolean> =
externallyManaged.getOptional("externally_managed")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonValue = inputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun inputsSchemaDefinition(): Optional<InputsSchemaDefinition> =
inputsSchemaDefinition.getOptional("inputs_schema_definition")
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonValue = outputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun outputsSchemaDefinition(): Optional<OutputsSchemaDefinition> =
outputsSchemaDefinition.getOptional("outputs_schema_definition")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -612,6 +709,33 @@ private constructor(
@ExcludeMissing
fun _externallyManaged(): JsonField<Boolean> = externallyManaged
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [inputsSchemaDefinition].
*
* Unlike [inputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonField<InputsSchemaDefinition> = inputsSchemaDefinition
/**
* Returns the raw JSON value of [outputsSchemaDefinition].
*
* Unlike [outputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonField<OutputsSchemaDefinition> = outputsSchemaDefinition
/**
* Returns the raw JSON value of [transformations].
*
@@ -656,9 +780,10 @@ private constructor(
private var dataType: JsonField<DataType> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var externallyManaged: JsonField<Boolean> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var inputsSchemaDefinition: JsonValue = JsonMissing.of()
private var outputsSchemaDefinition: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of()
private var outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> =
JsonMissing.of()
private var transformations: JsonField<MutableList<DatasetTransformation>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -771,15 +896,63 @@ private constructor(
this.externallyManaged = externallyManaged
}
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonValue) = apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonValue) = apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun inputsSchemaDefinition(inputsSchemaDefinition: InputsSchemaDefinition?) =
inputsSchemaDefinition(JsonField.ofNullable(inputsSchemaDefinition))
/**
* Alias for calling [Builder.inputsSchemaDefinition] with
* `inputsSchemaDefinition.orElse(null)`.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: Optional<InputsSchemaDefinition>) =
inputsSchemaDefinition(inputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.inputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.inputsSchemaDefinition] with a well-typed
* [InputsSchemaDefinition] value instead. This method is primarily for setting the
* field to an undocumented or not yet supported value.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonField<InputsSchemaDefinition>) =
apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun outputsSchemaDefinition(outputsSchemaDefinition: OutputsSchemaDefinition?) =
outputsSchemaDefinition(JsonField.ofNullable(outputsSchemaDefinition))
/**
* Alias for calling [Builder.outputsSchemaDefinition] with
* `outputsSchemaDefinition.orElse(null)`.
*/
fun outputsSchemaDefinition(
outputsSchemaDefinition: Optional<OutputsSchemaDefinition>
) = outputsSchemaDefinition(outputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.outputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.outputsSchemaDefinition] with a well-typed
* [OutputsSchemaDefinition] value instead. This method is primarily for setting the
* field to an undocumented or not yet supported value.
*/
fun outputsSchemaDefinition(
outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>
) = apply { this.outputsSchemaDefinition = outputsSchemaDefinition }
fun transformations(transformations: List<DatasetTransformation>?) =
transformations(JsonField.ofNullable(transformations))
@@ -871,6 +1044,9 @@ private constructor(
dataType().ifPresent { it.validate() }
description()
externallyManaged()
extra().ifPresent { it.validate() }
inputsSchemaDefinition().ifPresent { it.validate() }
outputsSchemaDefinition().ifPresent { it.validate() }
transformations().ifPresent { it.forEach { it.validate() } }
validated = true
}
@@ -897,6 +1073,9 @@ private constructor(
(dataType.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (externallyManaged.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(inputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(outputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(transformations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
override fun equals(other: Any?): Boolean {
@@ -940,6 +1119,313 @@ private constructor(
"Body{name=$name, id=$id, createdAt=$createdAt, dataType=$dataType, description=$description, externallyManaged=$externallyManaged, extra=$extra, inputsSchemaDefinition=$inputsSchemaDefinition, outputsSchemaDefinition=$outputsSchemaDefinition, transformations=$transformations, additionalProperties=$additionalProperties}"
}
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class InputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [InputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [InputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputsSchemaDefinition: InputsSchemaDefinition) = apply {
additionalProperties = inputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [InputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): InputsSchemaDefinition =
InputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): InputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is InputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"InputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
class OutputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [OutputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [OutputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputsSchemaDefinition: OutputsSchemaDefinition) = apply {
additionalProperties = outputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [OutputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): OutputsSchemaDefinition =
OutputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): OutputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is OutputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"OutputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -238,10 +238,10 @@ private constructor(
/**
* Alias for calling [inputsSchemaDefinition] with
* `InputsSchemaDefinition.ofJsonValue(jsonValue)`.
* `InputsSchemaDefinition.ofUnionMember0(unionMember0)`.
*/
fun inputsSchemaDefinition(jsonValue: JsonValue) = apply {
body.inputsSchemaDefinition(jsonValue)
fun inputsSchemaDefinition(unionMember0: InputsSchemaDefinition.UnionMember0) = apply {
body.inputsSchemaDefinition(unionMember0)
}
/**
@@ -266,8 +266,8 @@ private constructor(
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
/** Alias for calling [metadata] with `Metadata.ofJsonValue(jsonValue)`. */
fun metadata(jsonValue: JsonValue) = apply { body.metadata(jsonValue) }
/** Alias for calling [metadata] with `Metadata.ofUnionMember0(unionMember0)`. */
fun metadata(unionMember0: Metadata.UnionMember0) = apply { body.metadata(unionMember0) }
/** Alias for calling [metadata] with `Metadata.ofMissing(missing)`. */
fun metadata(missing: Missing) = apply { body.metadata(missing) }
@@ -316,10 +316,10 @@ private constructor(
/**
* Alias for calling [outputsSchemaDefinition] with
* `OutputsSchemaDefinition.ofJsonValue(jsonValue)`.
* `OutputsSchemaDefinition.ofUnionMember0(unionMember0)`.
*/
fun outputsSchemaDefinition(jsonValue: JsonValue) = apply {
body.outputsSchemaDefinition(jsonValue)
fun outputsSchemaDefinition(unionMember0: OutputsSchemaDefinition.UnionMember0) = apply {
body.outputsSchemaDefinition(unionMember0)
}
/**
@@ -764,10 +764,10 @@ private constructor(
/**
* Alias for calling [inputsSchemaDefinition] with
* `InputsSchemaDefinition.ofJsonValue(jsonValue)`.
* `InputsSchemaDefinition.ofUnionMember0(unionMember0)`.
*/
fun inputsSchemaDefinition(jsonValue: JsonValue) =
inputsSchemaDefinition(InputsSchemaDefinition.ofJsonValue(jsonValue))
fun inputsSchemaDefinition(unionMember0: InputsSchemaDefinition.UnionMember0) =
inputsSchemaDefinition(InputsSchemaDefinition.ofUnionMember0(unionMember0))
/**
* Alias for calling [inputsSchemaDefinition] with
@@ -790,8 +790,9 @@ private constructor(
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
/** Alias for calling [metadata] with `Metadata.ofJsonValue(jsonValue)`. */
fun metadata(jsonValue: JsonValue) = metadata(Metadata.ofJsonValue(jsonValue))
/** Alias for calling [metadata] with `Metadata.ofUnionMember0(unionMember0)`. */
fun metadata(unionMember0: Metadata.UnionMember0) =
metadata(Metadata.ofUnionMember0(unionMember0))
/** Alias for calling [metadata] with `Metadata.ofMissing(missing)`. */
fun metadata(missing: Missing) = metadata(Metadata.ofMissing(missing))
@@ -840,10 +841,10 @@ private constructor(
/**
* Alias for calling [outputsSchemaDefinition] with
* `OutputsSchemaDefinition.ofJsonValue(jsonValue)`.
* `OutputsSchemaDefinition.ofUnionMember0(unionMember0)`.
*/
fun outputsSchemaDefinition(jsonValue: JsonValue) =
outputsSchemaDefinition(OutputsSchemaDefinition.ofJsonValue(jsonValue))
fun outputsSchemaDefinition(unionMember0: OutputsSchemaDefinition.UnionMember0) =
outputsSchemaDefinition(OutputsSchemaDefinition.ofUnionMember0(unionMember0))
/**
* Alias for calling [outputsSchemaDefinition] with
@@ -1185,20 +1186,20 @@ private constructor(
@JsonSerialize(using = InputsSchemaDefinition.Serializer::class)
class InputsSchemaDefinition
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val missing: Missing? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun missing(): Optional<Missing> = Optional.ofNullable(missing)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isMissing(): Boolean = missing != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asMissing(): Missing = missing.getOrThrow("missing")
@@ -1206,7 +1207,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
missing != null -> visitor.visitMissing(missing)
else -> visitor.unknown(_json)
}
@@ -1220,7 +1221,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitMissing(missing: Missing) {
missing.validate()
@@ -1248,7 +1251,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitMissing(missing: Missing) = missing.validity()
@@ -1262,15 +1266,15 @@ private constructor(
}
return other is InputsSchemaDefinition &&
jsonValue == other.jsonValue &&
unionMember0 == other.unionMember0 &&
missing == other.missing
}
override fun hashCode(): Int = Objects.hash(jsonValue, missing)
override fun hashCode(): Int = Objects.hash(unionMember0, missing)
override fun toString(): String =
when {
jsonValue != null -> "InputsSchemaDefinition{jsonValue=$jsonValue}"
unionMember0 != null -> "InputsSchemaDefinition{unionMember0=$unionMember0}"
missing != null -> "InputsSchemaDefinition{missing=$missing}"
_json != null -> "InputsSchemaDefinition{_unknown=$_json}"
else -> throw IllegalStateException("Invalid InputsSchemaDefinition")
@@ -1279,7 +1283,8 @@ private constructor(
companion object {
@JvmStatic
fun ofJsonValue(jsonValue: JsonValue) = InputsSchemaDefinition(jsonValue = jsonValue)
fun ofUnionMember0(unionMember0: UnionMember0) =
InputsSchemaDefinition(unionMember0 = unionMember0)
@JvmStatic fun ofMissing(missing: Missing) = InputsSchemaDefinition(missing = missing)
}
@@ -1290,7 +1295,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitMissing(missing: Missing): T
@@ -1317,19 +1322,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
InputsSchemaDefinition(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Missing>())?.let {
InputsSchemaDefinition(missing = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
InputsSchemaDefinition(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from boolean).
0 -> InputsSchemaDefinition(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -1349,33 +1354,135 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.missing != null -> generator.writeObject(value.missing)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid InputsSchemaDefinition")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
@JsonDeserialize(using = Metadata.Deserializer::class)
@JsonSerialize(using = Metadata.Serializer::class)
class Metadata
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val missing: Missing? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun missing(): Optional<Missing> = Optional.ofNullable(missing)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isMissing(): Boolean = missing != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asMissing(): Missing = missing.getOrThrow("missing")
@@ -1383,7 +1490,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
missing != null -> visitor.visitMissing(missing)
else -> visitor.unknown(_json)
}
@@ -1397,7 +1504,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitMissing(missing: Missing) {
missing.validate()
@@ -1425,7 +1534,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitMissing(missing: Missing) = missing.validity()
@@ -1438,14 +1548,16 @@ private constructor(
return true
}
return other is Metadata && jsonValue == other.jsonValue && missing == other.missing
return other is Metadata &&
unionMember0 == other.unionMember0 &&
missing == other.missing
}
override fun hashCode(): Int = Objects.hash(jsonValue, missing)
override fun hashCode(): Int = Objects.hash(unionMember0, missing)
override fun toString(): String =
when {
jsonValue != null -> "Metadata{jsonValue=$jsonValue}"
unionMember0 != null -> "Metadata{unionMember0=$unionMember0}"
missing != null -> "Metadata{missing=$missing}"
_json != null -> "Metadata{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Metadata")
@@ -1453,7 +1565,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Metadata(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Metadata(unionMember0 = unionMember0)
@JvmStatic fun ofMissing(missing: Missing) = Metadata(missing = missing)
}
@@ -1463,7 +1576,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitMissing(missing: Missing): T
@@ -1489,19 +1602,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Metadata(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Missing>())?.let {
Metadata(missing = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Metadata(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from boolean).
0 -> Metadata(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -1520,13 +1633,115 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.missing != null -> generator.writeObject(value.missing)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Metadata")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
@JsonDeserialize(using = Name.Deserializer::class)
@@ -1701,20 +1916,20 @@ private constructor(
@JsonSerialize(using = OutputsSchemaDefinition.Serializer::class)
class OutputsSchemaDefinition
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val missing: Missing? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun missing(): Optional<Missing> = Optional.ofNullable(missing)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isMissing(): Boolean = missing != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asMissing(): Missing = missing.getOrThrow("missing")
@@ -1722,7 +1937,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
missing != null -> visitor.visitMissing(missing)
else -> visitor.unknown(_json)
}
@@ -1736,7 +1951,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitMissing(missing: Missing) {
missing.validate()
@@ -1764,7 +1981,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitMissing(missing: Missing) = missing.validity()
@@ -1778,15 +1996,15 @@ private constructor(
}
return other is OutputsSchemaDefinition &&
jsonValue == other.jsonValue &&
unionMember0 == other.unionMember0 &&
missing == other.missing
}
override fun hashCode(): Int = Objects.hash(jsonValue, missing)
override fun hashCode(): Int = Objects.hash(unionMember0, missing)
override fun toString(): String =
when {
jsonValue != null -> "OutputsSchemaDefinition{jsonValue=$jsonValue}"
unionMember0 != null -> "OutputsSchemaDefinition{unionMember0=$unionMember0}"
missing != null -> "OutputsSchemaDefinition{missing=$missing}"
_json != null -> "OutputsSchemaDefinition{_unknown=$_json}"
else -> throw IllegalStateException("Invalid OutputsSchemaDefinition")
@@ -1795,7 +2013,8 @@ private constructor(
companion object {
@JvmStatic
fun ofJsonValue(jsonValue: JsonValue) = OutputsSchemaDefinition(jsonValue = jsonValue)
fun ofUnionMember0(unionMember0: UnionMember0) =
OutputsSchemaDefinition(unionMember0 = unionMember0)
@JvmStatic fun ofMissing(missing: Missing) = OutputsSchemaDefinition(missing = missing)
}
@@ -1806,7 +2025,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitMissing(missing: Missing): T
@@ -1833,19 +2052,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
OutputsSchemaDefinition(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Missing>())?.let {
OutputsSchemaDefinition(missing = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
OutputsSchemaDefinition(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from boolean).
0 -> OutputsSchemaDefinition(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -1865,13 +2084,115 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.missing != null -> generator.writeObject(value.missing)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid OutputsSchemaDefinition")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
class PatchExamples
@@ -30,8 +30,8 @@ private constructor(
private val dataType: JsonField<DataType>,
private val description: JsonField<String>,
private val externallyManaged: JsonField<Boolean>,
private val inputsSchemaDefinition: JsonValue,
private val outputsSchemaDefinition: JsonValue,
private val inputsSchemaDefinition: JsonField<InputsSchemaDefinition>,
private val outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>,
private val transformations: JsonField<List<DatasetTransformation>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -53,10 +53,10 @@ private constructor(
externallyManaged: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
inputsSchemaDefinition: JsonValue = JsonMissing.of(),
inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
outputsSchemaDefinition: JsonValue = JsonMissing.of(),
outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("transformations")
@ExcludeMissing
transformations: JsonField<List<DatasetTransformation>> = JsonMissing.of(),
@@ -118,13 +118,19 @@ private constructor(
*/
fun externallyManaged(): Optional<Boolean> = externallyManaged.getOptional("externally_managed")
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonValue = inputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputsSchemaDefinition(): Optional<InputsSchemaDefinition> =
inputsSchemaDefinition.getOptional("inputs_schema_definition")
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonValue = outputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputsSchemaDefinition(): Optional<OutputsSchemaDefinition> =
outputsSchemaDefinition.getOptional("outputs_schema_definition")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -187,6 +193,26 @@ private constructor(
@ExcludeMissing
fun _externallyManaged(): JsonField<Boolean> = externallyManaged
/**
* Returns the raw JSON value of [inputsSchemaDefinition].
*
* Unlike [inputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonField<InputsSchemaDefinition> = inputsSchemaDefinition
/**
* Returns the raw JSON value of [outputsSchemaDefinition].
*
* Unlike [outputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonField<OutputsSchemaDefinition> = outputsSchemaDefinition
/**
* Returns the raw JSON value of [transformations].
*
@@ -233,8 +259,8 @@ private constructor(
private var dataType: JsonField<DataType> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var externallyManaged: JsonField<Boolean> = JsonMissing.of()
private var inputsSchemaDefinition: JsonValue = JsonMissing.of()
private var outputsSchemaDefinition: JsonValue = JsonMissing.of()
private var inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of()
private var outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of()
private var transformations: JsonField<MutableList<DatasetTransformation>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -349,13 +375,49 @@ private constructor(
this.externallyManaged = externallyManaged
}
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonValue) = apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun inputsSchemaDefinition(inputsSchemaDefinition: InputsSchemaDefinition?) =
inputsSchemaDefinition(JsonField.ofNullable(inputsSchemaDefinition))
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonValue) = apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
/**
* Alias for calling [Builder.inputsSchemaDefinition] with
* `inputsSchemaDefinition.orElse(null)`.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: Optional<InputsSchemaDefinition>) =
inputsSchemaDefinition(inputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.inputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.inputsSchemaDefinition] with a well-typed
* [InputsSchemaDefinition] value instead. This method is primarily for setting the field to
* an undocumented or not yet supported value.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonField<InputsSchemaDefinition>) =
apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun outputsSchemaDefinition(outputsSchemaDefinition: OutputsSchemaDefinition?) =
outputsSchemaDefinition(JsonField.ofNullable(outputsSchemaDefinition))
/**
* Alias for calling [Builder.outputsSchemaDefinition] with
* `outputsSchemaDefinition.orElse(null)`.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: Optional<OutputsSchemaDefinition>) =
outputsSchemaDefinition(outputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.outputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.outputsSchemaDefinition] with a well-typed
* [OutputsSchemaDefinition] value instead. This method is primarily for setting the field
* to an undocumented or not yet supported value.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>) =
apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
fun transformations(transformations: List<DatasetTransformation>?) =
transformations(JsonField.ofNullable(transformations))
@@ -450,6 +512,8 @@ private constructor(
dataType().ifPresent { it.validate() }
description()
externallyManaged()
inputsSchemaDefinition().ifPresent { it.validate() }
outputsSchemaDefinition().ifPresent { it.validate() }
transformations().ifPresent { it.forEach { it.validate() } }
validated = true
}
@@ -476,8 +540,218 @@ private constructor(
(dataType.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (externallyManaged.asKnown().isPresent) 1 else 0) +
(inputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(outputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(transformations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
class InputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [InputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [InputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputsSchemaDefinition: InputsSchemaDefinition) = apply {
additionalProperties = inputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [InputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): InputsSchemaDefinition =
InputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): InputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is InputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"InputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
class OutputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [OutputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [OutputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputsSchemaDefinition: OutputsSchemaDefinition) = apply {
additionalProperties = outputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [OutputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): OutputsSchemaDefinition =
OutputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): OutputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is OutputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"OutputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -46,7 +46,7 @@ private constructor(
private val comparativeExperimentId: JsonField<String>,
private val correction: JsonField<Correction>,
private val createdAt: JsonField<OffsetDateTime>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val feedbackConfig: JsonField<FeedbackConfig>,
private val feedbackGroupId: JsonField<String>,
private val feedbackSource: JsonField<FeedbackSource>,
@@ -70,7 +70,7 @@ private constructor(
@JsonProperty("created_at")
@ExcludeMissing
createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("feedback_config")
@ExcludeMissing
feedbackConfig: JsonField<FeedbackConfig> = JsonMissing.of(),
@@ -139,7 +139,11 @@ private constructor(
*/
fun createdAt(): Optional<OffsetDateTime> = createdAt.getOptional("created_at")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -228,6 +232,13 @@ private constructor(
@ExcludeMissing
fun _createdAt(): JsonField<OffsetDateTime> = createdAt
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [feedbackConfig].
*
@@ -312,7 +323,7 @@ private constructor(
private var comparativeExperimentId: JsonField<String> = JsonMissing.of()
private var correction: JsonField<Correction> = JsonMissing.of()
private var createdAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var feedbackConfig: JsonField<FeedbackConfig> = JsonMissing.of()
private var feedbackGroupId: JsonField<String> = JsonMissing.of()
private var feedbackSource: JsonField<FeedbackSource> = JsonMissing.of()
@@ -407,8 +418,9 @@ private constructor(
*/
fun correction(correction: JsonField<Correction>) = apply { this.correction = correction }
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = correction(Correction.ofJsonValue(jsonValue))
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) =
correction(Correction.ofUnionMember0(unionMember0))
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = correction(Correction.ofString(string))
@@ -424,7 +436,18 @@ private constructor(
*/
fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply { this.createdAt = createdAt }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun feedbackConfig(feedbackConfig: FeedbackConfig?) =
feedbackConfig(JsonField.ofNullable(feedbackConfig))
@@ -549,8 +572,8 @@ private constructor(
/** Alias for calling [value] with `Value.ofString(string)`. */
fun value(string: String) = value(Value.ofString(string))
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = value(Value.ofJson(json))
/** Alias for calling [value] with `Value.ofUnionMember3(unionMember3)`. */
fun value(unionMember3: Value.UnionMember3) = value(Value.ofUnionMember3(unionMember3))
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
@@ -615,6 +638,7 @@ private constructor(
comparativeExperimentId()
correction().ifPresent { it.validate() }
createdAt()
extra().ifPresent { it.validate() }
feedbackConfig().ifPresent { it.validate() }
feedbackGroupId()
feedbackSource().ifPresent { it.validate() }
@@ -645,6 +669,7 @@ private constructor(
(if (comparativeExperimentId.asKnown().isPresent) 1 else 0) +
(correction.asKnown().getOrNull()?.validity() ?: 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(feedbackConfig.asKnown().getOrNull()?.validity() ?: 0) +
(if (feedbackGroupId.asKnown().isPresent) 1 else 0) +
(feedbackSource.asKnown().getOrNull()?.validity() ?: 0) +
@@ -656,20 +681,20 @@ private constructor(
@JsonSerialize(using = Correction.Serializer::class)
class Correction
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val string: String? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun string(): Optional<String> = Optional.ofNullable(string)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isString(): Boolean = string != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asString(): String = string.getOrThrow("string")
@@ -677,7 +702,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
string != null -> visitor.visitString(string)
else -> visitor.unknown(_json)
}
@@ -691,7 +716,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitString(string: String) {}
}
@@ -717,7 +744,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitString(string: String) = 1
@@ -730,14 +758,16 @@ private constructor(
return true
}
return other is Correction && jsonValue == other.jsonValue && string == other.string
return other is Correction &&
unionMember0 == other.unionMember0 &&
string == other.string
}
override fun hashCode(): Int = Objects.hash(jsonValue, string)
override fun hashCode(): Int = Objects.hash(unionMember0, string)
override fun toString(): String =
when {
jsonValue != null -> "Correction{jsonValue=$jsonValue}"
unionMember0 != null -> "Correction{unionMember0=$unionMember0}"
string != null -> "Correction{string=$string}"
_json != null -> "Correction{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Correction")
@@ -745,7 +775,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Correction(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Correction(unionMember0 = unionMember0)
@JvmStatic fun ofString(string: String) = Correction(string = string)
}
@@ -755,7 +786,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitString(string: String): T
@@ -781,19 +812,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Correction(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Correction(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Correction(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Correction(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -812,13 +843,214 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.string != null -> generator.writeObject(value.string)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Correction")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class FeedbackConfig
@@ -1869,7 +2101,7 @@ private constructor(
private val number: Double? = null,
private val bool: Boolean? = null,
private val string: String? = null,
private val json: JsonValue? = null,
private val unionMember3: UnionMember3? = null,
private val _json: JsonValue? = null,
) {
@@ -1879,7 +2111,7 @@ private constructor(
fun string(): Optional<String> = Optional.ofNullable(string)
fun json(): Optional<JsonValue> = Optional.ofNullable(json)
fun unionMember3(): Optional<UnionMember3> = Optional.ofNullable(unionMember3)
fun isNumber(): Boolean = number != null
@@ -1887,7 +2119,7 @@ private constructor(
fun isString(): Boolean = string != null
fun isJson(): Boolean = json != null
fun isUnionMember3(): Boolean = unionMember3 != null
fun asNumber(): Double = number.getOrThrow("number")
@@ -1895,7 +2127,7 @@ private constructor(
fun asString(): String = string.getOrThrow("string")
fun asJson(): JsonValue = json.getOrThrow("json")
fun asUnionMember3(): UnionMember3 = unionMember3.getOrThrow("unionMember3")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
@@ -1904,7 +2136,7 @@ private constructor(
number != null -> visitor.visitNumber(number)
bool != null -> visitor.visitBool(bool)
string != null -> visitor.visitString(string)
json != null -> visitor.visitJson(json)
unionMember3 != null -> visitor.visitUnionMember3(unionMember3)
else -> visitor.unknown(_json)
}
@@ -1923,7 +2155,9 @@ private constructor(
override fun visitString(string: String) {}
override fun visitJson(json: JsonValue) {}
override fun visitUnionMember3(unionMember3: UnionMember3) {
unionMember3.validate()
}
}
)
validated = true
@@ -1953,7 +2187,8 @@ private constructor(
override fun visitString(string: String) = 1
override fun visitJson(json: JsonValue) = 1
override fun visitUnionMember3(unionMember3: UnionMember3) =
unionMember3.validity()
override fun unknown(json: JsonValue?) = 0
}
@@ -1968,17 +2203,17 @@ private constructor(
number == other.number &&
bool == other.bool &&
string == other.string &&
json == other.json
unionMember3 == other.unionMember3
}
override fun hashCode(): Int = Objects.hash(number, bool, string, json)
override fun hashCode(): Int = Objects.hash(number, bool, string, unionMember3)
override fun toString(): String =
when {
number != null -> "Value{number=$number}"
bool != null -> "Value{bool=$bool}"
string != null -> "Value{string=$string}"
json != null -> "Value{json=$json}"
unionMember3 != null -> "Value{unionMember3=$unionMember3}"
_json != null -> "Value{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Value")
}
@@ -1991,7 +2226,8 @@ private constructor(
@JvmStatic fun ofString(string: String) = Value(string = string)
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
@JvmStatic
fun ofUnionMember3(unionMember3: UnionMember3) = Value(unionMember3 = unionMember3)
}
/** An interface that defines how to map each variant of [Value] to a value of type [T]. */
@@ -2003,7 +2239,7 @@ private constructor(
fun visitString(string: String): T
fun visitJson(json: JsonValue): T
fun visitUnionMember3(unionMember3: UnionMember3): T
/**
* Maps an unknown variant of [Value] to a value of type [T].
@@ -2027,6 +2263,9 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember3>())?.let {
Value(unionMember3 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Double>())?.let {
Value(number = it, _json = json)
},
@@ -2036,16 +2275,13 @@ private constructor(
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Value(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Value(json = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Value(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -2067,12 +2303,114 @@ private constructor(
value.number != null -> generator.writeObject(value.number)
value.bool != null -> generator.writeObject(value.bool)
value.string != null -> generator.writeObject(value.string)
value.json != null -> generator.writeObject(value.json)
value.unionMember3 != null -> generator.writeObject(value.unionMember3)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Value")
}
}
}
class UnionMember3
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember3]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember3]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember3: UnionMember3) = apply {
additionalProperties = unionMember3.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember3].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember3 = UnionMember3(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember3 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember3 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember3{additionalProperties=$additionalProperties}"
}
}
override fun equals(other: Any?): Boolean {
@@ -55,7 +55,11 @@ private constructor(
*/
fun description(): Optional<String> = body.description()
fun _extra(): JsonValue = body._extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = body.extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -103,6 +107,13 @@ private constructor(
*/
fun _description(): JsonField<String> = body._description()
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _extra(): JsonField<Extra> = body._extra()
/**
* Returns the raw JSON value of [modifiedAt].
*
@@ -231,7 +242,18 @@ private constructor(
*/
fun description(description: JsonField<String>) = apply { body.description(description) }
fun extra(extra: JsonValue) = apply { body.extra(extra) }
fun extra(extra: Extra?) = apply { body.extra(extra) }
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { body.extra(extra) }
fun modifiedAt(modifiedAt: OffsetDateTime) = apply { body.modifiedAt(modifiedAt) }
@@ -431,7 +453,7 @@ private constructor(
private val id: JsonField<String>,
private val createdAt: JsonField<OffsetDateTime>,
private val description: JsonField<String>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val modifiedAt: JsonField<OffsetDateTime>,
private val name: JsonField<String>,
private val referenceDatasetId: JsonField<String>,
@@ -450,7 +472,7 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField<String> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("modified_at")
@ExcludeMissing
modifiedAt: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -494,7 +516,11 @@ private constructor(
*/
fun description(): Optional<String> = description.getOptional("description")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -550,6 +576,13 @@ private constructor(
@ExcludeMissing
fun _description(): JsonField<String> = description
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [modifiedAt].
*
@@ -608,7 +641,7 @@ private constructor(
private var id: JsonField<String> = JsonMissing.of()
private var createdAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var modifiedAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var referenceDatasetId: JsonField<String> = JsonMissing.of()
@@ -693,7 +726,19 @@ private constructor(
this.description = description
}
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun modifiedAt(modifiedAt: OffsetDateTime) = modifiedAt(JsonField.of(modifiedAt))
@@ -799,6 +844,7 @@ private constructor(
id()
createdAt()
description()
extra().ifPresent { it.validate() }
modifiedAt()
name()
referenceDatasetId()
@@ -825,6 +871,7 @@ private constructor(
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(if (modifiedAt.asKnown().isPresent) 1 else 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(if (referenceDatasetId.asKnown().isPresent) 1 else 0)
@@ -866,6 +913,105 @@ private constructor(
"Body{experimentIds=$experimentIds, id=$id, createdAt=$createdAt, description=$description, extra=$extra, modifiedAt=$modifiedAt, name=$name, referenceDatasetId=$referenceDatasetId, additionalProperties=$additionalProperties}"
}
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -11,6 +11,7 @@ import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -28,7 +29,7 @@ private constructor(
private val referenceDatasetId: JsonField<String>,
private val tenantId: JsonField<String>,
private val description: JsonField<String>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val name: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -49,7 +50,7 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField<String> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
) : this(
id,
@@ -99,7 +100,11 @@ private constructor(
*/
fun description(): Optional<String> = description.getOptional("description")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -156,6 +161,13 @@ private constructor(
*/
@JsonProperty("description") @ExcludeMissing fun _description(): JsonField<String> = description
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [name].
*
@@ -201,7 +213,7 @@ private constructor(
private var referenceDatasetId: JsonField<String>? = null
private var tenantId: JsonField<String>? = null
private var description: JsonField<String> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -290,7 +302,18 @@ private constructor(
*/
fun description(description: JsonField<String>) = apply { this.description = description }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun name(name: String?) = name(JsonField.ofNullable(name))
@@ -367,6 +390,7 @@ private constructor(
referenceDatasetId()
tenantId()
description()
extra().ifPresent { it.validate() }
name()
validated = true
}
@@ -392,8 +416,108 @@ private constructor(
(if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
(if (tenantId.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0)
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -31,8 +31,8 @@ private constructor(
private val referenceDatasetId: JsonField<String>,
private val tenantId: JsonField<String>,
private val description: JsonField<String>,
private val extra: JsonValue,
private val feedbackStats: JsonValue,
private val extra: JsonField<Extra>,
private val feedbackStats: JsonField<FeedbackStats>,
private val name: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -56,8 +56,10 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField<String> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("feedback_stats") @ExcludeMissing feedbackStats: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("feedback_stats")
@ExcludeMissing
feedbackStats: JsonField<FeedbackStats> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
) : this(
id,
@@ -116,9 +118,17 @@ private constructor(
*/
fun description(): Optional<String> = description.getOptional("description")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
@JsonProperty("feedback_stats") @ExcludeMissing fun _feedbackStats(): JsonValue = feedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun feedbackStats(): Optional<FeedbackStats> = feedbackStats.getOptional("feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -184,6 +194,22 @@ private constructor(
*/
@JsonProperty("description") @ExcludeMissing fun _description(): JsonField<String> = description
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [feedbackStats].
*
* Unlike [feedbackStats], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonField<FeedbackStats> = feedbackStats
/**
* Returns the raw JSON value of [name].
*
@@ -231,8 +257,8 @@ private constructor(
private var referenceDatasetId: JsonField<String>? = null
private var tenantId: JsonField<String>? = null
private var description: JsonField<String> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var feedbackStats: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var feedbackStats: JsonField<FeedbackStats> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -349,9 +375,36 @@ private constructor(
*/
fun description(description: JsonField<String>) = apply { this.description = description }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
fun feedbackStats(feedbackStats: JsonValue) = apply { this.feedbackStats = feedbackStats }
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun feedbackStats(feedbackStats: FeedbackStats?) =
feedbackStats(JsonField.ofNullable(feedbackStats))
/** Alias for calling [Builder.feedbackStats] with `feedbackStats.orElse(null)`. */
fun feedbackStats(feedbackStats: Optional<FeedbackStats>) =
feedbackStats(feedbackStats.getOrNull())
/**
* Sets [Builder.feedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.feedbackStats] with a well-typed [FeedbackStats] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun feedbackStats(feedbackStats: JsonField<FeedbackStats>) = apply {
this.feedbackStats = feedbackStats
}
fun name(name: String?) = name(JsonField.ofNullable(name))
@@ -432,6 +485,8 @@ private constructor(
referenceDatasetId()
tenantId()
description()
extra().ifPresent { it.validate() }
feedbackStats().ifPresent { it.validate() }
name()
validated = true
}
@@ -458,8 +513,208 @@ private constructor(
(if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
(if (tenantId.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(feedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0)
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class FeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [FeedbackStats]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [FeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(feedbackStats: FeedbackStats) = apply {
additionalProperties = feedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [FeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): FeedbackStats = FeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): FeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is FeedbackStats && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "FeedbackStats{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -236,7 +236,7 @@ private constructor(
private val completionTokens: JsonField<Long>,
private val count: JsonField<Long>,
private val errorRate: JsonField<Double>,
private val feedbackStats: JsonValue,
private val feedbackStats: JsonField<FeedbackStats>,
private val latencyP50: JsonField<Double>,
private val latencyP99: JsonField<Double>,
private val maxStartTime: JsonField<OffsetDateTime>,
@@ -275,7 +275,7 @@ private constructor(
errorRate: JsonField<Double> = JsonMissing.of(),
@JsonProperty("feedback_stats")
@ExcludeMissing
feedbackStats: JsonValue = JsonMissing.of(),
feedbackStats: JsonField<FeedbackStats> = JsonMissing.of(),
@JsonProperty("latency_p50")
@ExcludeMissing
latencyP50: JsonField<Double> = JsonMissing.of(),
@@ -376,9 +376,11 @@ private constructor(
*/
fun errorRate(): Optional<Double> = errorRate.getOptional("error_rate")
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonValue = feedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun feedbackStats(): Optional<FeedbackStats> = feedbackStats.getOptional("feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -504,6 +506,16 @@ private constructor(
*/
@JsonProperty("error_rate") @ExcludeMissing fun _errorRate(): JsonField<Double> = errorRate
/**
* Returns the raw JSON value of [feedbackStats].
*
* Unlike [feedbackStats], this method doesn't throw if the JSON field has an unexpected
* type.
*/
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonField<FeedbackStats> = feedbackStats
/**
* Returns the raw JSON value of [latencyP50].
*
@@ -618,7 +630,7 @@ private constructor(
private var completionTokens: JsonField<Long> = JsonMissing.of()
private var count: JsonField<Long> = JsonMissing.of()
private var errorRate: JsonField<Double> = JsonMissing.of()
private var feedbackStats: JsonValue = JsonMissing.of()
private var feedbackStats: JsonField<FeedbackStats> = JsonMissing.of()
private var latencyP50: JsonField<Double> = JsonMissing.of()
private var latencyP99: JsonField<Double> = JsonMissing.of()
private var maxStartTime: JsonField<OffsetDateTime> = JsonMissing.of()
@@ -831,7 +843,21 @@ private constructor(
*/
fun errorRate(errorRate: JsonField<Double>) = apply { this.errorRate = errorRate }
fun feedbackStats(feedbackStats: JsonValue) = apply {
fun feedbackStats(feedbackStats: FeedbackStats?) =
feedbackStats(JsonField.ofNullable(feedbackStats))
/** Alias for calling [Builder.feedbackStats] with `feedbackStats.orElse(null)`. */
fun feedbackStats(feedbackStats: Optional<FeedbackStats>) =
feedbackStats(feedbackStats.getOrNull())
/**
* Sets [Builder.feedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.feedbackStats] with a well-typed [FeedbackStats]
* value instead. This method is primarily for setting the field to an undocumented or
* not yet supported value.
*/
fun feedbackStats(feedbackStats: JsonField<FeedbackStats>) = apply {
this.feedbackStats = feedbackStats
}
@@ -1060,6 +1086,7 @@ private constructor(
completionTokens()
count()
errorRate()
feedbackStats().ifPresent { it.validate() }
latencyP50()
latencyP99()
maxStartTime()
@@ -1096,6 +1123,7 @@ private constructor(
(if (completionTokens.asKnown().isPresent) 1 else 0) +
(if (count.asKnown().isPresent) 1 else 0) +
(if (errorRate.asKnown().isPresent) 1 else 0) +
(feedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (latencyP50.asKnown().isPresent) 1 else 0) +
(if (latencyP99.asKnown().isPresent) 1 else 0) +
(if (maxStartTime.asKnown().isPresent) 1 else 0) +
@@ -1296,8 +1324,8 @@ private constructor(
private val endTime: JsonField<OffsetDateTime>,
private val errorRate: JsonField<Double>,
private val exampleCount: JsonField<Long>,
private val extra: JsonValue,
private val feedbackStats: JsonValue,
private val extra: JsonField<Extra>,
private val feedbackStats: JsonField<FeedbackStats>,
private val firstTokenP50: JsonField<Double>,
private val firstTokenP99: JsonField<Double>,
private val lastRunStartTime: JsonField<OffsetDateTime>,
@@ -1311,8 +1339,8 @@ private constructor(
private val promptTokens: JsonField<Long>,
private val referenceDatasetId: JsonField<String>,
private val runCount: JsonField<Long>,
private val runFacets: JsonField<List<JsonValue>>,
private val sessionFeedbackStats: JsonValue,
private val runFacets: JsonField<List<RunFacet>>,
private val sessionFeedbackStats: JsonField<SessionFeedbackStats>,
private val startTime: JsonField<OffsetDateTime>,
private val streamingRate: JsonField<Double>,
private val testRunNumber: JsonField<Long>,
@@ -1352,10 +1380,10 @@ private constructor(
@JsonProperty("example_count")
@ExcludeMissing
exampleCount: JsonField<Long> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("feedback_stats")
@ExcludeMissing
feedbackStats: JsonValue = JsonMissing.of(),
feedbackStats: JsonField<FeedbackStats> = JsonMissing.of(),
@JsonProperty("first_token_p50")
@ExcludeMissing
firstTokenP50: JsonField<Double> = JsonMissing.of(),
@@ -1395,10 +1423,10 @@ private constructor(
runCount: JsonField<Long> = JsonMissing.of(),
@JsonProperty("run_facets")
@ExcludeMissing
runFacets: JsonField<List<JsonValue>> = JsonMissing.of(),
runFacets: JsonField<List<RunFacet>> = JsonMissing.of(),
@JsonProperty("session_feedback_stats")
@ExcludeMissing
sessionFeedbackStats: JsonValue = JsonMissing.of(),
sessionFeedbackStats: JsonField<SessionFeedbackStats> = JsonMissing.of(),
@JsonProperty("start_time")
@ExcludeMissing
startTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -1519,11 +1547,18 @@ private constructor(
*/
fun exampleCount(): Optional<Long> = exampleCount.getOptional("example_count")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonValue = feedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
*/
fun feedbackStats(): Optional<FeedbackStats> =
feedbackStats.getOptional("feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
@@ -1612,11 +1647,14 @@ private constructor(
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
*/
fun runFacets(): Optional<List<JsonValue>> = runFacets.getOptional("run_facets")
fun runFacets(): Optional<List<RunFacet>> = runFacets.getOptional("run_facets")
@JsonProperty("session_feedback_stats")
@ExcludeMissing
fun _sessionFeedbackStats(): JsonValue = sessionFeedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
*/
fun sessionFeedbackStats(): Optional<SessionFeedbackStats> =
sessionFeedbackStats.getOptional("session_feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
@@ -1745,6 +1783,23 @@ private constructor(
@ExcludeMissing
fun _exampleCount(): JsonField<Long> = exampleCount
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [feedbackStats].
*
* Unlike [feedbackStats], this method doesn't throw if the JSON field has an unexpected
* type.
*/
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonField<FeedbackStats> = feedbackStats
/**
* Returns the raw JSON value of [firstTokenP50].
*
@@ -1878,7 +1933,17 @@ private constructor(
*/
@JsonProperty("run_facets")
@ExcludeMissing
fun _runFacets(): JsonField<List<JsonValue>> = runFacets
fun _runFacets(): JsonField<List<RunFacet>> = runFacets
/**
* Returns the raw JSON value of [sessionFeedbackStats].
*
* Unlike [sessionFeedbackStats], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("session_feedback_stats")
@ExcludeMissing
fun _sessionFeedbackStats(): JsonField<SessionFeedbackStats> = sessionFeedbackStats
/**
* Returns the raw JSON value of [startTime].
@@ -1980,8 +2045,8 @@ private constructor(
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var errorRate: JsonField<Double> = JsonMissing.of()
private var exampleCount: JsonField<Long> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var feedbackStats: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var feedbackStats: JsonField<FeedbackStats> = JsonMissing.of()
private var firstTokenP50: JsonField<Double> = JsonMissing.of()
private var firstTokenP99: JsonField<Double> = JsonMissing.of()
private var lastRunStartTime: JsonField<OffsetDateTime> = JsonMissing.of()
@@ -1995,8 +2060,8 @@ private constructor(
private var promptTokens: JsonField<Long> = JsonMissing.of()
private var referenceDatasetId: JsonField<String> = JsonMissing.of()
private var runCount: JsonField<Long> = JsonMissing.of()
private var runFacets: JsonField<MutableList<JsonValue>>? = null
private var sessionFeedbackStats: JsonValue = JsonMissing.of()
private var runFacets: JsonField<MutableList<RunFacet>>? = null
private var sessionFeedbackStats: JsonField<SessionFeedbackStats> = JsonMissing.of()
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var streamingRate: JsonField<Double> = JsonMissing.of()
private var testRunNumber: JsonField<Long> = JsonMissing.of()
@@ -2224,9 +2289,35 @@ private constructor(
this.exampleCount = exampleCount
}
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
fun feedbackStats(feedbackStats: JsonValue) = apply {
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun feedbackStats(feedbackStats: FeedbackStats?) =
feedbackStats(JsonField.ofNullable(feedbackStats))
/** Alias for calling [Builder.feedbackStats] with `feedbackStats.orElse(null)`. */
fun feedbackStats(feedbackStats: Optional<FeedbackStats>) =
feedbackStats(feedbackStats.getOrNull())
/**
* Sets [Builder.feedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.feedbackStats] with a well-typed [FeedbackStats]
* value instead. This method is primarily for setting the field to an undocumented
* or not yet supported value.
*/
fun feedbackStats(feedbackStats: JsonField<FeedbackStats>) = apply {
this.feedbackStats = feedbackStats
}
@@ -2498,39 +2589,57 @@ private constructor(
*/
fun runCount(runCount: JsonField<Long>) = apply { this.runCount = runCount }
fun runFacets(runFacets: List<JsonValue>?) =
fun runFacets(runFacets: List<RunFacet>?) =
runFacets(JsonField.ofNullable(runFacets))
/** Alias for calling [Builder.runFacets] with `runFacets.orElse(null)`. */
fun runFacets(runFacets: Optional<List<JsonValue>>) =
fun runFacets(runFacets: Optional<List<RunFacet>>) =
runFacets(runFacets.getOrNull())
/**
* Sets [Builder.runFacets] to an arbitrary JSON value.
*
* You should usually call [Builder.runFacets] with a well-typed `List<JsonValue>`
* You should usually call [Builder.runFacets] with a well-typed `List<RunFacet>`
* value instead. This method is primarily for setting the field to an undocumented
* or not yet supported value.
*/
fun runFacets(runFacets: JsonField<List<JsonValue>>) = apply {
fun runFacets(runFacets: JsonField<List<RunFacet>>) = apply {
this.runFacets = runFacets.map { it.toMutableList() }
}
/**
* Adds a single [JsonValue] to [runFacets].
* Adds a single [RunFacet] to [runFacets].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
fun addRunFacet(runFacet: JsonValue) = apply {
fun addRunFacet(runFacet: RunFacet) = apply {
runFacets =
(runFacets ?: JsonField.of(mutableListOf())).also {
checkKnown("runFacets", it).add(runFacet)
}
}
fun sessionFeedbackStats(sessionFeedbackStats: JsonValue) = apply {
this.sessionFeedbackStats = sessionFeedbackStats
}
fun sessionFeedbackStats(sessionFeedbackStats: SessionFeedbackStats?) =
sessionFeedbackStats(JsonField.ofNullable(sessionFeedbackStats))
/**
* Alias for calling [Builder.sessionFeedbackStats] with
* `sessionFeedbackStats.orElse(null)`.
*/
fun sessionFeedbackStats(sessionFeedbackStats: Optional<SessionFeedbackStats>) =
sessionFeedbackStats(sessionFeedbackStats.getOrNull())
/**
* Sets [Builder.sessionFeedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.sessionFeedbackStats] with a well-typed
* [SessionFeedbackStats] value instead. This method is primarily for setting the
* field to an undocumented or not yet supported value.
*/
fun sessionFeedbackStats(sessionFeedbackStats: JsonField<SessionFeedbackStats>) =
apply {
this.sessionFeedbackStats = sessionFeedbackStats
}
fun startTime(startTime: OffsetDateTime) = startTime(JsonField.of(startTime))
@@ -2740,6 +2849,8 @@ private constructor(
endTime()
errorRate()
exampleCount()
extra().ifPresent { it.validate() }
feedbackStats().ifPresent { it.validate() }
firstTokenP50()
firstTokenP99()
lastRunStartTime()
@@ -2753,7 +2864,8 @@ private constructor(
promptTokens()
referenceDatasetId()
runCount()
runFacets()
runFacets().ifPresent { it.forEach { it.validate() } }
sessionFeedbackStats().ifPresent { it.validate() }
startTime()
streamingRate()
testRunNumber()
@@ -2789,6 +2901,8 @@ private constructor(
(if (endTime.asKnown().isPresent) 1 else 0) +
(if (errorRate.asKnown().isPresent) 1 else 0) +
(if (exampleCount.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(feedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (firstTokenP50.asKnown().isPresent) 1 else 0) +
(if (firstTokenP99.asKnown().isPresent) 1 else 0) +
(if (lastRunStartTime.asKnown().isPresent) 1 else 0) +
@@ -2802,7 +2916,8 @@ private constructor(
(if (promptTokens.asKnown().isPresent) 1 else 0) +
(if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
(if (runCount.asKnown().isPresent) 1 else 0) +
(runFacets.asKnown().getOrNull()?.size ?: 0) +
(runFacets.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(sessionFeedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (startTime.asKnown().isPresent) 1 else 0) +
(if (streamingRate.asKnown().isPresent) 1 else 0) +
(if (testRunNumber.asKnown().isPresent) 1 else 0) +
@@ -2810,6 +2925,433 @@ private constructor(
(if (totalTokens.asKnown().isPresent) 1 else 0) +
(traceTier.asKnown().getOrNull()?.validity() ?: 0)
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class FeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [FeedbackStats].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [FeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(feedbackStats: FeedbackStats) = apply {
additionalProperties = feedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [FeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): FeedbackStats = FeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): FeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is FeedbackStats &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"FeedbackStats{additionalProperties=$additionalProperties}"
}
class RunFacet
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [RunFacet]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [RunFacet]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(runFacet: RunFacet) = apply {
additionalProperties = runFacet.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [RunFacet].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): RunFacet = RunFacet(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): RunFacet = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is RunFacet && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "RunFacet{additionalProperties=$additionalProperties}"
}
class SessionFeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of
* [SessionFeedbackStats].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [SessionFeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(sessionFeedbackStats: SessionFeedbackStats) = apply {
additionalProperties =
sessionFeedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [SessionFeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): SessionFeedbackStats =
SessionFeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): SessionFeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is SessionFeedbackStats &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"SessionFeedbackStats{additionalProperties=$additionalProperties}"
}
class TraceTier @JsonCreator private constructor(private val value: JsonField<String>) :
Enum {
@@ -3028,6 +3570,108 @@ private constructor(
"Session{id=$id, filter=$filter, tenantId=$tenantId, completionCost=$completionCost, completionTokens=$completionTokens, defaultDatasetId=$defaultDatasetId, description=$description, endTime=$endTime, errorRate=$errorRate, exampleCount=$exampleCount, extra=$extra, feedbackStats=$feedbackStats, firstTokenP50=$firstTokenP50, firstTokenP99=$firstTokenP99, lastRunStartTime=$lastRunStartTime, lastRunStartTimeLive=$lastRunStartTimeLive, latencyP50=$latencyP50, latencyP99=$latencyP99, maxStartTime=$maxStartTime, minStartTime=$minStartTime, name=$name, promptCost=$promptCost, promptTokens=$promptTokens, referenceDatasetId=$referenceDatasetId, runCount=$runCount, runFacets=$runFacets, sessionFeedbackStats=$sessionFeedbackStats, startTime=$startTime, streamingRate=$streamingRate, testRunNumber=$testRunNumber, totalCost=$totalCost, totalTokens=$totalTokens, traceTier=$traceTier, additionalProperties=$additionalProperties}"
}
class FeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [FeedbackStats]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [FeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(feedbackStats: FeedbackStats) = apply {
additionalProperties = feedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [FeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): FeedbackStats = FeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): FeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is FeedbackStats && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "FeedbackStats{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -82,7 +82,11 @@ private constructor(
*/
fun evaluatorRules(): Optional<List<String>> = body.evaluatorRules()
fun _metadata(): JsonValue = body._metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = body.metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -207,6 +211,13 @@ private constructor(
*/
fun _evaluatorRules(): JsonField<List<String>> = body._evaluatorRules()
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _metadata(): JsonField<Metadata> = body._metadata()
/**
* Returns the raw JSON value of [owner].
*
@@ -477,7 +488,19 @@ private constructor(
*/
fun addEvaluatorRule(evaluatorRule: String) = apply { body.addEvaluatorRule(evaluatorRule) }
fun metadata(metadata: JsonValue) = apply { body.metadata(metadata) }
fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
fun owner(owner: String?) = apply { body.owner(owner) }
@@ -826,7 +849,7 @@ private constructor(
private val commit: JsonField<String>,
private val datasetSplits: JsonField<List<String>>,
private val evaluatorRules: JsonField<List<String>>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val owner: JsonField<String>,
private val parallelToolCalls: JsonField<Boolean>,
private val repetitions: JsonField<Long>,
@@ -864,7 +887,9 @@ private constructor(
@JsonProperty("evaluator_rules")
@ExcludeMissing
evaluatorRules: JsonField<List<String>> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("owner") @ExcludeMissing owner: JsonField<String> = JsonMissing.of(),
@JsonProperty("parallel_tool_calls")
@ExcludeMissing
@@ -969,7 +994,11 @@ private constructor(
*/
fun evaluatorRules(): Optional<List<String>> = evaluatorRules.getOptional("evaluator_rules")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -1105,6 +1134,13 @@ private constructor(
@ExcludeMissing
fun _evaluatorRules(): JsonField<List<String>> = evaluatorRules
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [owner].
*
@@ -1241,7 +1277,7 @@ private constructor(
private var commit: JsonField<String> = JsonMissing.of()
private var datasetSplits: JsonField<MutableList<String>>? = null
private var evaluatorRules: JsonField<MutableList<String>>? = null
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var owner: JsonField<String> = JsonMissing.of()
private var parallelToolCalls: JsonField<Boolean> = JsonMissing.of()
private var repetitions: JsonField<Long> = JsonMissing.of()
@@ -1425,7 +1461,19 @@ private constructor(
}
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun owner(owner: String?) = owner(JsonField.ofNullable(owner))
@@ -1701,6 +1749,7 @@ private constructor(
commit()
datasetSplits()
evaluatorRules()
metadata().ifPresent { it.validate() }
owner()
parallelToolCalls()
repetitions()
@@ -1739,6 +1788,7 @@ private constructor(
(if (commit.asKnown().isPresent) 1 else 0) +
(datasetSplits.asKnown().getOrNull()?.size ?: 0) +
(evaluatorRules.asKnown().getOrNull()?.size ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (owner.asKnown().isPresent) 1 else 0) +
(if (parallelToolCalls.asKnown().isPresent) 1 else 0) +
(if (repetitions.asKnown().isPresent) 1 else 0) +
@@ -1913,6 +1963,105 @@ private constructor(
override fun toString() = "Secrets{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -76,7 +76,11 @@ private constructor(
*/
fun evaluatorRules(): Optional<List<String>> = body.evaluatorRules()
fun _metadata(): JsonValue = body._metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = body.metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -194,6 +198,13 @@ private constructor(
*/
fun _evaluatorRules(): JsonField<List<String>> = body._evaluatorRules()
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _metadata(): JsonField<Metadata> = body._metadata()
/**
* Returns the raw JSON value of [owner].
*
@@ -444,7 +455,19 @@ private constructor(
*/
fun addEvaluatorRule(evaluatorRule: String) = apply { body.addEvaluatorRule(evaluatorRule) }
fun metadata(metadata: JsonValue) = apply { body.metadata(metadata) }
fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
fun owner(owner: String?) = apply { body.owner(owner) }
@@ -792,7 +815,7 @@ private constructor(
private val commit: JsonField<String>,
private val datasetSplits: JsonField<List<String>>,
private val evaluatorRules: JsonField<List<String>>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val owner: JsonField<String>,
private val parallelToolCalls: JsonField<Boolean>,
private val repetitions: JsonField<Long>,
@@ -827,7 +850,9 @@ private constructor(
@JsonProperty("evaluator_rules")
@ExcludeMissing
evaluatorRules: JsonField<List<String>> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("owner") @ExcludeMissing owner: JsonField<String> = JsonMissing.of(),
@JsonProperty("parallel_tool_calls")
@ExcludeMissing
@@ -925,7 +950,11 @@ private constructor(
*/
fun evaluatorRules(): Optional<List<String>> = evaluatorRules.getOptional("evaluator_rules")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -1054,6 +1083,13 @@ private constructor(
@ExcludeMissing
fun _evaluatorRules(): JsonField<List<String>> = evaluatorRules
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [owner].
*
@@ -1189,7 +1225,7 @@ private constructor(
private var commit: JsonField<String> = JsonMissing.of()
private var datasetSplits: JsonField<MutableList<String>>? = null
private var evaluatorRules: JsonField<MutableList<String>>? = null
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var owner: JsonField<String> = JsonMissing.of()
private var parallelToolCalls: JsonField<Boolean> = JsonMissing.of()
private var repetitions: JsonField<Long> = JsonMissing.of()
@@ -1351,7 +1387,19 @@ private constructor(
}
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun owner(owner: String?) = owner(JsonField.ofNullable(owner))
@@ -1625,6 +1673,7 @@ private constructor(
commit()
datasetSplits()
evaluatorRules()
metadata().ifPresent { it.validate() }
owner()
parallelToolCalls()
repetitions()
@@ -1662,6 +1711,7 @@ private constructor(
(if (commit.asKnown().isPresent) 1 else 0) +
(datasetSplits.asKnown().getOrNull()?.size ?: 0) +
(evaluatorRules.asKnown().getOrNull()?.size ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (owner.asKnown().isPresent) 1 else 0) +
(if (parallelToolCalls.asKnown().isPresent) 1 else 0) +
(if (repetitions.asKnown().isPresent) 1 else 0) +
@@ -1834,6 +1884,105 @@ private constructor(
override fun toString() = "Secrets{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -34,9 +34,9 @@ class RunnableConfig
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val callbacks: JsonField<Callbacks>,
private val configurable: JsonValue,
private val configurable: JsonField<Configurable>,
private val maxConcurrency: JsonField<Long>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val recursionLimit: JsonField<Long>,
private val runId: JsonField<String>,
private val runName: JsonField<String>,
@@ -49,11 +49,13 @@ private constructor(
@JsonProperty("callbacks")
@ExcludeMissing
callbacks: JsonField<Callbacks> = JsonMissing.of(),
@JsonProperty("configurable") @ExcludeMissing configurable: JsonValue = JsonMissing.of(),
@JsonProperty("configurable")
@ExcludeMissing
configurable: JsonField<Configurable> = JsonMissing.of(),
@JsonProperty("max_concurrency")
@ExcludeMissing
maxConcurrency: JsonField<Long> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("recursion_limit")
@ExcludeMissing
recursionLimit: JsonField<Long> = JsonMissing.of(),
@@ -78,7 +80,11 @@ private constructor(
*/
fun callbacks(): Optional<Callbacks> = callbacks.getOptional("callbacks")
@JsonProperty("configurable") @ExcludeMissing fun _configurable(): JsonValue = configurable
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun configurable(): Optional<Configurable> = configurable.getOptional("configurable")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -86,7 +92,11 @@ private constructor(
*/
fun maxConcurrency(): Optional<Long> = maxConcurrency.getOptional("max_concurrency")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -119,6 +129,15 @@ private constructor(
*/
@JsonProperty("callbacks") @ExcludeMissing fun _callbacks(): JsonField<Callbacks> = callbacks
/**
* Returns the raw JSON value of [configurable].
*
* Unlike [configurable], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("configurable")
@ExcludeMissing
fun _configurable(): JsonField<Configurable> = configurable
/**
* Returns the raw JSON value of [maxConcurrency].
*
@@ -128,6 +147,13 @@ private constructor(
@ExcludeMissing
fun _maxConcurrency(): JsonField<Long> = maxConcurrency
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [recursionLimit].
*
@@ -180,9 +206,9 @@ private constructor(
class Builder internal constructor() {
private var callbacks: JsonField<Callbacks> = JsonMissing.of()
private var configurable: JsonValue = JsonMissing.of()
private var configurable: JsonField<Configurable> = JsonMissing.of()
private var maxConcurrency: JsonField<Long> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var recursionLimit: JsonField<Long> = JsonMissing.of()
private var runId: JsonField<String> = JsonMissing.of()
private var runName: JsonField<String> = JsonMissing.of()
@@ -223,7 +249,18 @@ private constructor(
/** Alias for calling [callbacks] with `Callbacks.ofJsonValue(jsonValue)`. */
fun callbacks(jsonValue: JsonValue) = callbacks(Callbacks.ofJsonValue(jsonValue))
fun configurable(configurable: JsonValue) = apply { this.configurable = configurable }
fun configurable(configurable: Configurable) = configurable(JsonField.of(configurable))
/**
* Sets [Builder.configurable] to an arbitrary JSON value.
*
* You should usually call [Builder.configurable] with a well-typed [Configurable] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun configurable(configurable: JsonField<Configurable>) = apply {
this.configurable = configurable
}
fun maxConcurrency(maxConcurrency: Long?) =
maxConcurrency(JsonField.ofNullable(maxConcurrency))
@@ -250,7 +287,16 @@ private constructor(
this.maxConcurrency = maxConcurrency
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata) = metadata(JsonField.of(metadata))
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun recursionLimit(recursionLimit: Long) = recursionLimit(JsonField.of(recursionLimit))
@@ -356,7 +402,9 @@ private constructor(
}
callbacks().ifPresent { it.validate() }
configurable().ifPresent { it.validate() }
maxConcurrency()
metadata().ifPresent { it.validate() }
recursionLimit()
runId()
runName()
@@ -380,7 +428,9 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(callbacks.asKnown().getOrNull()?.validity() ?: 0) +
(configurable.asKnown().getOrNull()?.validity() ?: 0) +
(if (maxConcurrency.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (recursionLimit.asKnown().isPresent) 1 else 0) +
(if (runId.asKnown().isPresent) 1 else 0) +
(if (runName.asKnown().isPresent) 1 else 0) +
@@ -559,6 +609,204 @@ private constructor(
}
}
class Configurable
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Configurable]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Configurable]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(configurable: Configurable) = apply {
additionalProperties = configurable.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Configurable].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Configurable = Configurable(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Configurable = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Configurable && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Configurable{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -11,6 +11,7 @@ import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -24,13 +25,13 @@ class Example
private constructor(
private val id: JsonField<String>,
private val datasetId: JsonField<String>,
private val inputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val name: JsonField<String>,
private val attachmentUrls: JsonValue,
private val attachmentUrls: JsonField<AttachmentUrls>,
private val createdAt: JsonField<OffsetDateTime>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val modifiedAt: JsonField<OffsetDateTime>,
private val outputs: JsonValue,
private val outputs: JsonField<Outputs>,
private val sourceRunId: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -39,19 +40,19 @@ private constructor(
private constructor(
@JsonProperty("id") @ExcludeMissing id: JsonField<String> = JsonMissing.of(),
@JsonProperty("dataset_id") @ExcludeMissing datasetId: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
@JsonProperty("attachment_urls")
@ExcludeMissing
attachmentUrls: JsonValue = JsonMissing.of(),
attachmentUrls: JsonField<AttachmentUrls> = JsonMissing.of(),
@JsonProperty("created_at")
@ExcludeMissing
createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("modified_at")
@ExcludeMissing
modifiedAt: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("source_run_id")
@ExcludeMissing
sourceRunId: JsonField<String> = JsonMissing.of(),
@@ -81,7 +82,11 @@ private constructor(
*/
fun datasetId(): String = datasetId.getRequired("dataset_id")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException 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 inputs(): Inputs = inputs.getRequired("inputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -89,9 +94,11 @@ private constructor(
*/
fun name(): String = name.getRequired("name")
@JsonProperty("attachment_urls")
@ExcludeMissing
fun _attachmentUrls(): JsonValue = attachmentUrls
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun attachmentUrls(): Optional<AttachmentUrls> = attachmentUrls.getOptional("attachment_urls")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -99,7 +106,11 @@ private constructor(
*/
fun createdAt(): Optional<OffsetDateTime> = createdAt.getOptional("created_at")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -107,7 +118,11 @@ private constructor(
*/
fun modifiedAt(): Optional<OffsetDateTime> = modifiedAt.getOptional("modified_at")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -129,6 +144,13 @@ private constructor(
*/
@JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField<String> = datasetId
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [name].
*
@@ -136,6 +158,15 @@ private constructor(
*/
@JsonProperty("name") @ExcludeMissing fun _name(): JsonField<String> = name
/**
* Returns the raw JSON value of [attachmentUrls].
*
* Unlike [attachmentUrls], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("attachment_urls")
@ExcludeMissing
fun _attachmentUrls(): JsonField<AttachmentUrls> = attachmentUrls
/**
* Returns the raw JSON value of [createdAt].
*
@@ -145,6 +176,13 @@ private constructor(
@ExcludeMissing
fun _createdAt(): JsonField<OffsetDateTime> = createdAt
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [modifiedAt].
*
@@ -154,6 +192,13 @@ private constructor(
@ExcludeMissing
fun _modifiedAt(): JsonField<OffsetDateTime> = modifiedAt
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [sourceRunId].
*
@@ -196,13 +241,13 @@ private constructor(
private var id: JsonField<String>? = null
private var datasetId: JsonField<String>? = null
private var inputs: JsonValue? = null
private var inputs: JsonField<Inputs>? = null
private var name: JsonField<String>? = null
private var attachmentUrls: JsonValue = JsonMissing.of()
private var attachmentUrls: JsonField<AttachmentUrls> = JsonMissing.of()
private var createdAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var modifiedAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var sourceRunId: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -242,7 +287,15 @@ private constructor(
*/
fun datasetId(datasetId: JsonField<String>) = apply { this.datasetId = datasetId }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs) = inputs(JsonField.of(inputs))
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun name(name: String) = name(JsonField.of(name))
@@ -254,7 +307,21 @@ private constructor(
*/
fun name(name: JsonField<String>) = apply { this.name = name }
fun attachmentUrls(attachmentUrls: JsonValue) = apply {
fun attachmentUrls(attachmentUrls: AttachmentUrls?) =
attachmentUrls(JsonField.ofNullable(attachmentUrls))
/** Alias for calling [Builder.attachmentUrls] with `attachmentUrls.orElse(null)`. */
fun attachmentUrls(attachmentUrls: Optional<AttachmentUrls>) =
attachmentUrls(attachmentUrls.getOrNull())
/**
* Sets [Builder.attachmentUrls] to an arbitrary JSON value.
*
* You should usually call [Builder.attachmentUrls] with a well-typed [AttachmentUrls] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun attachmentUrls(attachmentUrls: JsonField<AttachmentUrls>) = apply {
this.attachmentUrls = attachmentUrls
}
@@ -269,7 +336,19 @@ private constructor(
*/
fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply { this.createdAt = createdAt }
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun modifiedAt(modifiedAt: OffsetDateTime?) = modifiedAt(JsonField.ofNullable(modifiedAt))
@@ -287,7 +366,18 @@ private constructor(
this.modifiedAt = modifiedAt
}
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun sourceRunId(sourceRunId: String?) = sourceRunId(JsonField.ofNullable(sourceRunId))
@@ -362,9 +452,13 @@ private constructor(
id()
datasetId()
inputs().validate()
name()
attachmentUrls().ifPresent { it.validate() }
createdAt()
metadata().ifPresent { it.validate() }
modifiedAt()
outputs().ifPresent { it.validate() }
sourceRunId()
validated = true
}
@@ -386,11 +480,411 @@ private constructor(
internal fun validity(): Int =
(if (id.asKnown().isPresent) 1 else 0) +
(if (datasetId.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(attachmentUrls.asKnown().getOrNull()?.validity() ?: 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (modifiedAt.asKnown().isPresent) 1 else 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (sourceRunId.asKnown().isPresent) 1 else 0)
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class AttachmentUrls
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [AttachmentUrls]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [AttachmentUrls]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(attachmentUrls: AttachmentUrls) = apply {
additionalProperties = attachmentUrls.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [AttachmentUrls].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): AttachmentUrls = AttachmentUrls(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): AttachmentUrls = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is AttachmentUrls && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "AttachmentUrls{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -59,11 +59,23 @@ private constructor(
*/
fun createdAt(): Optional<String> = body.createdAt()
fun _inputs(): JsonValue = body._inputs()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = body.inputs()
fun _metadata(): JsonValue = body._metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = body.metadata()
fun _outputs(): JsonValue = body._outputs()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = body.outputs()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -118,6 +130,27 @@ private constructor(
*/
fun _createdAt(): JsonField<String> = body._createdAt()
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _inputs(): JsonField<Inputs> = body._inputs()
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _metadata(): JsonField<Metadata> = body._metadata()
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _outputs(): JsonField<Outputs> = body._outputs()
/**
* Returns the raw JSON value of [sourceRunId].
*
@@ -241,11 +274,45 @@ private constructor(
*/
fun createdAt(createdAt: JsonField<String>) = apply { body.createdAt(createdAt) }
fun inputs(inputs: JsonValue) = apply { body.inputs(inputs) }
fun inputs(inputs: Inputs?) = apply { body.inputs(inputs) }
fun metadata(metadata: JsonValue) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { body.outputs(outputs) }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { body.inputs(inputs) }
fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
fun outputs(outputs: Outputs?) = apply { body.outputs(outputs) }
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { body.outputs(outputs) }
fun sourceRunId(sourceRunId: String?) = apply { body.sourceRunId(sourceRunId) }
@@ -483,9 +550,9 @@ private constructor(
private val datasetId: JsonField<String>,
private val id: JsonField<String>,
private val createdAt: JsonField<String>,
private val inputs: JsonValue,
private val metadata: JsonValue,
private val outputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val metadata: JsonField<Metadata>,
private val outputs: JsonField<Outputs>,
private val sourceRunId: JsonField<String>,
private val split: JsonField<Split>,
private val useLegacyMessageFormat: JsonField<Boolean>,
@@ -503,9 +570,11 @@ private constructor(
@JsonProperty("created_at")
@ExcludeMissing
createdAt: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("source_run_id")
@ExcludeMissing
sourceRunId: JsonField<String> = JsonMissing.of(),
@@ -552,11 +621,23 @@ private constructor(
*/
fun createdAt(): Optional<String> = createdAt.getOptional("created_at")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = inputs.getOptional("inputs")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -613,6 +694,27 @@ private constructor(
*/
@JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField<String> = createdAt
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [sourceRunId].
*
@@ -690,9 +792,9 @@ private constructor(
private var datasetId: JsonField<String>? = null
private var id: JsonField<String> = JsonMissing.of()
private var createdAt: JsonField<String> = JsonMissing.of()
private var inputs: JsonValue = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var inputs: JsonField<Inputs> = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var sourceRunId: JsonField<String> = JsonMissing.of()
private var split: JsonField<Split> = JsonMissing.of()
private var useLegacyMessageFormat: JsonField<Boolean> = JsonMissing.of()
@@ -752,11 +854,47 @@ private constructor(
*/
fun createdAt(createdAt: JsonField<String>) = apply { this.createdAt = createdAt }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs?) = inputs(JsonField.ofNullable(inputs))
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun sourceRunId(sourceRunId: String?) = sourceRunId(JsonField.ofNullable(sourceRunId))
@@ -907,6 +1045,9 @@ private constructor(
datasetId()
id()
createdAt()
inputs().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
outputs().ifPresent { it.validate() }
sourceRunId()
split().ifPresent { it.validate() }
useLegacyMessageFormat()
@@ -934,6 +1075,9 @@ private constructor(
(if (datasetId.asKnown().isPresent) 1 else 0) +
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (sourceRunId.asKnown().isPresent) 1 else 0) +
(split.asKnown().getOrNull()?.validity() ?: 0) +
(if (useLegacyMessageFormat.asKnown().isPresent) 1 else 0) +
@@ -983,6 +1127,303 @@ private constructor(
"Body{datasetId=$datasetId, id=$id, createdAt=$createdAt, inputs=$inputs, metadata=$metadata, outputs=$outputs, sourceRunId=$sourceRunId, split=$split, useLegacyMessageFormat=$useLegacyMessageFormat, useSourceRunAttachments=$useSourceRunAttachments, useSourceRunIo=$useSourceRunIo, additionalProperties=$additionalProperties}"
}
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Split.Deserializer::class)
@JsonSerialize(using = Split.Serializer::class)
class Split
@@ -54,11 +54,23 @@ private constructor(
*/
fun datasetId(): Optional<String> = body.datasetId()
fun _inputs(): JsonValue = body._inputs()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = body.inputs()
fun _metadata(): JsonValue = body._metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = body.metadata()
fun _outputs(): JsonValue = body._outputs()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = body.outputs()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -87,6 +99,27 @@ private constructor(
*/
fun _datasetId(): JsonField<String> = body._datasetId()
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _inputs(): JsonField<Inputs> = body._inputs()
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _metadata(): JsonField<Metadata> = body._metadata()
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _outputs(): JsonField<Outputs> = body._outputs()
/**
* Returns the raw JSON value of [overwrite].
*
@@ -190,11 +223,45 @@ private constructor(
*/
fun datasetId(datasetId: JsonField<String>) = apply { body.datasetId(datasetId) }
fun inputs(inputs: JsonValue) = apply { body.inputs(inputs) }
fun inputs(inputs: Inputs?) = apply { body.inputs(inputs) }
fun metadata(metadata: JsonValue) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { body.outputs(outputs) }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { body.inputs(inputs) }
fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
fun outputs(outputs: Outputs?) = apply { body.outputs(outputs) }
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { body.outputs(outputs) }
fun overwrite(overwrite: Boolean) = apply { body.overwrite(overwrite) }
@@ -375,9 +442,9 @@ private constructor(
private constructor(
private val attachmentsOperations: JsonField<AttachmentsOperations>,
private val datasetId: JsonField<String>,
private val inputs: JsonValue,
private val metadata: JsonValue,
private val outputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val metadata: JsonField<Metadata>,
private val outputs: JsonField<Outputs>,
private val overwrite: JsonField<Boolean>,
private val split: JsonField<Split>,
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -391,9 +458,11 @@ private constructor(
@JsonProperty("dataset_id")
@ExcludeMissing
datasetId: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("overwrite")
@ExcludeMissing
overwrite: JsonField<Boolean> = JsonMissing.of(),
@@ -422,11 +491,23 @@ private constructor(
*/
fun datasetId(): Optional<String> = datasetId.getOptional("dataset_id")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = inputs.getOptional("inputs")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -457,6 +538,27 @@ private constructor(
*/
@JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField<String> = datasetId
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [overwrite].
*
@@ -494,9 +596,9 @@ private constructor(
private var attachmentsOperations: JsonField<AttachmentsOperations> = JsonMissing.of()
private var datasetId: JsonField<String> = JsonMissing.of()
private var inputs: JsonValue = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var inputs: JsonField<Inputs> = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var overwrite: JsonField<Boolean> = JsonMissing.of()
private var split: JsonField<Split> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -549,11 +651,47 @@ private constructor(
*/
fun datasetId(datasetId: JsonField<String>) = apply { this.datasetId = datasetId }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs?) = inputs(JsonField.ofNullable(inputs))
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun overwrite(overwrite: Boolean) = overwrite(JsonField.of(overwrite))
@@ -632,6 +770,9 @@ private constructor(
attachmentsOperations().ifPresent { it.validate() }
datasetId()
inputs().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
outputs().ifPresent { it.validate() }
overwrite()
split().ifPresent { it.validate() }
validated = true
@@ -655,6 +796,9 @@ private constructor(
internal fun validity(): Int =
(attachmentsOperations.asKnown().getOrNull()?.validity() ?: 0) +
(if (datasetId.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (overwrite.asKnown().isPresent) 1 else 0) +
(split.asKnown().getOrNull()?.validity() ?: 0)
@@ -693,6 +837,303 @@ private constructor(
"Body{attachmentsOperations=$attachmentsOperations, datasetId=$datasetId, inputs=$inputs, metadata=$metadata, outputs=$outputs, overwrite=$overwrite, split=$split, additionalProperties=$additionalProperties}"
}
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Split.Deserializer::class)
@JsonSerialize(using = Split.Serializer::class)
class Split
@@ -222,9 +222,9 @@ private constructor(
private val datasetId: JsonField<String>,
private val id: JsonField<String>,
private val createdAt: JsonField<String>,
private val inputs: JsonValue,
private val metadata: JsonValue,
private val outputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val metadata: JsonField<Metadata>,
private val outputs: JsonField<Outputs>,
private val sourceRunId: JsonField<String>,
private val split: JsonField<Split>,
private val useLegacyMessageFormat: JsonField<Boolean>,
@@ -242,9 +242,11 @@ private constructor(
@JsonProperty("created_at")
@ExcludeMissing
createdAt: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("source_run_id")
@ExcludeMissing
sourceRunId: JsonField<String> = JsonMissing.of(),
@@ -291,11 +293,23 @@ private constructor(
*/
fun createdAt(): Optional<String> = createdAt.getOptional("created_at")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = inputs.getOptional("inputs")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -352,6 +366,27 @@ private constructor(
*/
@JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField<String> = createdAt
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [sourceRunId].
*
@@ -429,9 +464,9 @@ private constructor(
private var datasetId: JsonField<String>? = null
private var id: JsonField<String> = JsonMissing.of()
private var createdAt: JsonField<String> = JsonMissing.of()
private var inputs: JsonValue = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var inputs: JsonField<Inputs> = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var sourceRunId: JsonField<String> = JsonMissing.of()
private var split: JsonField<Split> = JsonMissing.of()
private var useLegacyMessageFormat: JsonField<Boolean> = JsonMissing.of()
@@ -494,11 +529,47 @@ private constructor(
*/
fun createdAt(createdAt: JsonField<String>) = apply { this.createdAt = createdAt }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs?) = inputs(JsonField.ofNullable(inputs))
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun sourceRunId(sourceRunId: String?) = sourceRunId(JsonField.ofNullable(sourceRunId))
@@ -649,6 +720,9 @@ private constructor(
datasetId()
id()
createdAt()
inputs().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
outputs().ifPresent { it.validate() }
sourceRunId()
split().ifPresent { it.validate() }
useLegacyMessageFormat()
@@ -676,12 +750,321 @@ private constructor(
(if (datasetId.asKnown().isPresent) 1 else 0) +
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (sourceRunId.asKnown().isPresent) 1 else 0) +
(split.asKnown().getOrNull()?.validity() ?: 0) +
(if (useLegacyMessageFormat.asKnown().isPresent) 1 else 0) +
(useSourceRunAttachments.asKnown().getOrNull()?.size ?: 0) +
(if (useSourceRunIo.asKnown().isPresent) 1 else 0)
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Split.Deserializer::class)
@JsonSerialize(using = Split.Serializer::class)
class Split
@@ -223,9 +223,9 @@ private constructor(
private val id: JsonField<String>,
private val attachmentsOperations: JsonField<AttachmentsOperations>,
private val datasetId: JsonField<String>,
private val inputs: JsonValue,
private val metadata: JsonValue,
private val outputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val metadata: JsonField<Metadata>,
private val outputs: JsonField<Outputs>,
private val overwrite: JsonField<Boolean>,
private val split: JsonField<Split>,
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -240,9 +240,11 @@ private constructor(
@JsonProperty("dataset_id")
@ExcludeMissing
datasetId: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("overwrite")
@ExcludeMissing
overwrite: JsonField<Boolean> = JsonMissing.of(),
@@ -278,11 +280,23 @@ private constructor(
*/
fun datasetId(): Optional<String> = datasetId.getOptional("dataset_id")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = inputs.getOptional("inputs")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -320,6 +334,27 @@ private constructor(
*/
@JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField<String> = datasetId
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [overwrite].
*
@@ -365,9 +400,9 @@ private constructor(
private var id: JsonField<String>? = null
private var attachmentsOperations: JsonField<AttachmentsOperations> = JsonMissing.of()
private var datasetId: JsonField<String> = JsonMissing.of()
private var inputs: JsonValue = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var inputs: JsonField<Inputs> = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var overwrite: JsonField<Boolean> = JsonMissing.of()
private var split: JsonField<Split> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -432,11 +467,47 @@ private constructor(
*/
fun datasetId(datasetId: JsonField<String>) = apply { this.datasetId = datasetId }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs?) = inputs(JsonField.ofNullable(inputs))
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun overwrite(overwrite: Boolean) = overwrite(JsonField.of(overwrite))
@@ -524,6 +595,9 @@ private constructor(
id()
attachmentsOperations().ifPresent { it.validate() }
datasetId()
inputs().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
outputs().ifPresent { it.validate() }
overwrite()
split().ifPresent { it.validate() }
validated = true
@@ -548,9 +622,318 @@ private constructor(
(if (id.asKnown().isPresent) 1 else 0) +
(attachmentsOperations.asKnown().getOrNull()?.validity() ?: 0) +
(if (datasetId.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (overwrite.asKnown().isPresent) 1 else 0) +
(split.asKnown().getOrNull()?.validity() ?: 0)
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Split.Deserializer::class)
@JsonSerialize(using = Split.Serializer::class)
class Split
@@ -36,9 +36,9 @@ private constructor(
private val id: JsonField<String>,
private val createdAt: JsonField<OffsetDateTime>,
private val datasetId: JsonField<String>,
private val inputs: JsonValue,
private val metadata: JsonValue,
private val outputs: JsonValue,
private val inputs: JsonField<Inputs>,
private val metadata: JsonField<Metadata>,
private val outputs: JsonField<Outputs>,
private val overwrite: JsonField<Boolean>,
private val sourceRunId: JsonField<String>,
private val split: JsonField<Split>,
@@ -53,9 +53,9 @@ private constructor(
@ExcludeMissing
createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("dataset_id") @ExcludeMissing datasetId: JsonField<String> = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonValue = JsonMissing.of(),
@JsonProperty("inputs") @ExcludeMissing inputs: JsonField<Inputs> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("outputs") @ExcludeMissing outputs: JsonField<Outputs> = JsonMissing.of(),
@JsonProperty("overwrite") @ExcludeMissing overwrite: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("source_run_id")
@ExcludeMissing
@@ -96,11 +96,23 @@ private constructor(
*/
fun datasetId(): Optional<String> = datasetId.getOptional("dataset_id")
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonValue = inputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputs(): Optional<Inputs> = inputs.getOptional("inputs")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonValue = outputs
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputs(): Optional<Outputs> = outputs.getOptional("outputs")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -149,6 +161,27 @@ private constructor(
*/
@JsonProperty("dataset_id") @ExcludeMissing fun _datasetId(): JsonField<String> = datasetId
/**
* Returns the raw JSON value of [inputs].
*
* Unlike [inputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("inputs") @ExcludeMissing fun _inputs(): JsonField<Inputs> = inputs
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [outputs].
*
* Unlike [outputs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("outputs") @ExcludeMissing fun _outputs(): JsonField<Outputs> = outputs
/**
* Returns the raw JSON value of [overwrite].
*
@@ -205,9 +238,9 @@ private constructor(
private var id: JsonField<String> = JsonMissing.of()
private var createdAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var datasetId: JsonField<String> = JsonMissing.of()
private var inputs: JsonValue = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var outputs: JsonValue = JsonMissing.of()
private var inputs: JsonField<Inputs> = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var outputs: JsonField<Outputs> = JsonMissing.of()
private var overwrite: JsonField<Boolean> = JsonMissing.of()
private var sourceRunId: JsonField<String> = JsonMissing.of()
private var split: JsonField<Split> = JsonMissing.of()
@@ -270,11 +303,45 @@ private constructor(
*/
fun datasetId(datasetId: JsonField<String>) = apply { this.datasetId = datasetId }
fun inputs(inputs: JsonValue) = apply { this.inputs = inputs }
fun inputs(inputs: Inputs?) = inputs(JsonField.ofNullable(inputs))
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
/** Alias for calling [Builder.inputs] with `inputs.orElse(null)`. */
fun inputs(inputs: Optional<Inputs>) = inputs(inputs.getOrNull())
fun outputs(outputs: JsonValue) = apply { this.outputs = outputs }
/**
* Sets [Builder.inputs] to an arbitrary JSON value.
*
* You should usually call [Builder.inputs] with a well-typed [Inputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun inputs(inputs: JsonField<Inputs>) = apply { this.inputs = inputs }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun outputs(outputs: Outputs?) = outputs(JsonField.ofNullable(outputs))
/** Alias for calling [Builder.outputs] with `outputs.orElse(null)`. */
fun outputs(outputs: Optional<Outputs>) = outputs(outputs.getOrNull())
/**
* Sets [Builder.outputs] to an arbitrary JSON value.
*
* You should usually call [Builder.outputs] with a well-typed [Outputs] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun outputs(outputs: JsonField<Outputs>) = apply { this.outputs = outputs }
fun overwrite(overwrite: Boolean) = overwrite(JsonField.of(overwrite))
@@ -383,6 +450,9 @@ private constructor(
id()
createdAt()
datasetId()
inputs().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
outputs().ifPresent { it.validate() }
overwrite()
sourceRunId()
split().ifPresent { it.validate() }
@@ -408,11 +478,311 @@ private constructor(
(if (id.asKnown().isPresent) 1 else 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(if (datasetId.asKnown().isPresent) 1 else 0) +
(inputs.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(outputs.asKnown().getOrNull()?.validity() ?: 0) +
(if (overwrite.asKnown().isPresent) 1 else 0) +
(if (sourceRunId.asKnown().isPresent) 1 else 0) +
(split.asKnown().getOrNull()?.validity() ?: 0) +
(if (useSourceRunIo.asKnown().isPresent) 1 else 0)
class Inputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Inputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Inputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputs: Inputs) = apply {
additionalProperties = inputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Inputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Inputs = Inputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Inputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Inputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Inputs{additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Outputs
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Outputs]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Outputs]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputs: Outputs) = apply {
additionalProperties = outputs.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Outputs].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Outputs = Outputs(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Outputs = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Outputs && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Outputs{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Split.Deserializer::class)
@JsonSerialize(using = Split.Serializer::class)
class Split
@@ -11,6 +11,7 @@ import com.langchain.smith.core.ExcludeMissing
import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -21,18 +22,22 @@ import kotlin.jvm.optionals.getOrNull
class ApiFeedbackSource
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val type: JsonField<Type>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@JsonCreator
private constructor(
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
) : this(metadata, type, mutableMapOf())
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -40,6 +45,13 @@ private constructor(
*/
fun type(): Optional<Type> = type.getOptional("type")
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [type].
*
@@ -68,7 +80,7 @@ private constructor(
/** A builder for [ApiFeedbackSource]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var type: JsonField<Type> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -79,7 +91,19 @@ private constructor(
additionalProperties = apiFeedbackSource.additionalProperties.toMutableMap()
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun type(type: Type) = type(JsonField.of(type))
@@ -126,6 +150,7 @@ private constructor(
return@apply
}
metadata().ifPresent { it.validate() }
type().ifPresent { it.validate() }
validated = true
}
@@ -143,7 +168,109 @@ private constructor(
*
* Used for best match union deserialization.
*/
@JvmSynthetic internal fun validity(): Int = (type.asKnown().getOrNull()?.validity() ?: 0)
@JvmSynthetic
internal fun validity(): Int =
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
@@ -11,6 +11,7 @@ import com.langchain.smith.core.ExcludeMissing
import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -21,18 +22,22 @@ import kotlin.jvm.optionals.getOrNull
class AppFeedbackSource
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val type: JsonField<Type>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@JsonCreator
private constructor(
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
) : this(metadata, type, mutableMapOf())
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -40,6 +45,13 @@ private constructor(
*/
fun type(): Optional<Type> = type.getOptional("type")
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [type].
*
@@ -68,7 +80,7 @@ private constructor(
/** A builder for [AppFeedbackSource]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var type: JsonField<Type> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -79,7 +91,19 @@ private constructor(
additionalProperties = appFeedbackSource.additionalProperties.toMutableMap()
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun type(type: Type) = type(JsonField.of(type))
@@ -126,6 +150,7 @@ private constructor(
return@apply
}
metadata().ifPresent { it.validate() }
type().ifPresent { it.validate() }
validated = true
}
@@ -143,7 +168,109 @@ private constructor(
*
* Used for best match union deserialization.
*/
@JvmSynthetic internal fun validity(): Int = (type.asKnown().getOrNull()?.validity() ?: 0)
@JvmSynthetic
internal fun validity(): Int =
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
@@ -11,6 +11,7 @@ import com.langchain.smith.core.ExcludeMissing
import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -21,18 +22,22 @@ import kotlin.jvm.optionals.getOrNull
class AutoEvalFeedbackSource
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val type: JsonField<Type>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@JsonCreator
private constructor(
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
) : this(metadata, type, mutableMapOf())
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -40,6 +45,13 @@ private constructor(
*/
fun type(): Optional<Type> = type.getOptional("type")
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [type].
*
@@ -68,7 +80,7 @@ private constructor(
/** A builder for [AutoEvalFeedbackSource]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var type: JsonField<Type> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -79,7 +91,19 @@ private constructor(
additionalProperties = autoEvalFeedbackSource.additionalProperties.toMutableMap()
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun type(type: Type) = type(JsonField.of(type))
@@ -126,6 +150,7 @@ private constructor(
return@apply
}
metadata().ifPresent { it.validate() }
type().ifPresent { it.validate() }
validated = true
}
@@ -143,7 +168,109 @@ private constructor(
*
* Used for best match union deserialization.
*/
@JvmSynthetic internal fun validity(): Int = (type.asKnown().getOrNull()?.validity() ?: 0)
@JvmSynthetic
internal fun validity(): Int =
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
@@ -468,8 +468,9 @@ private constructor(
*/
fun correction(correction: JsonField<Correction>) = apply { this.correction = correction }
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = correction(Correction.ofJsonValue(jsonValue))
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) =
correction(Correction.ofUnionMember0(unionMember0))
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = correction(Correction.ofString(string))
@@ -668,8 +669,8 @@ private constructor(
/** Alias for calling [value] with `Value.ofString(string)`. */
fun value(string: String) = value(Value.ofString(string))
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = value(Value.ofJson(json))
/** Alias for calling [value] with `Value.ofUnionMember3(unionMember3)`. */
fun value(unionMember3: Value.UnionMember3) = value(Value.ofUnionMember3(unionMember3))
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
@@ -786,20 +787,20 @@ private constructor(
@JsonSerialize(using = Correction.Serializer::class)
class Correction
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val string: String? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun string(): Optional<String> = Optional.ofNullable(string)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isString(): Boolean = string != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asString(): String = string.getOrThrow("string")
@@ -807,7 +808,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
string != null -> visitor.visitString(string)
else -> visitor.unknown(_json)
}
@@ -821,7 +822,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitString(string: String) {}
}
@@ -847,7 +850,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitString(string: String) = 1
@@ -860,14 +864,16 @@ private constructor(
return true
}
return other is Correction && jsonValue == other.jsonValue && string == other.string
return other is Correction &&
unionMember0 == other.unionMember0 &&
string == other.string
}
override fun hashCode(): Int = Objects.hash(jsonValue, string)
override fun hashCode(): Int = Objects.hash(unionMember0, string)
override fun toString(): String =
when {
jsonValue != null -> "Correction{jsonValue=$jsonValue}"
unionMember0 != null -> "Correction{unionMember0=$unionMember0}"
string != null -> "Correction{string=$string}"
_json != null -> "Correction{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Correction")
@@ -875,7 +881,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Correction(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Correction(unionMember0 = unionMember0)
@JvmStatic fun ofString(string: String) = Correction(string = string)
}
@@ -885,7 +892,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitString(string: String): T
@@ -911,19 +918,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Correction(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Correction(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Correction(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Correction(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -942,13 +949,115 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.string != null -> generator.writeObject(value.string)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Correction")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
class FeedbackConfig
@@ -1999,7 +2108,7 @@ private constructor(
private val number: Double? = null,
private val bool: Boolean? = null,
private val string: String? = null,
private val json: JsonValue? = null,
private val unionMember3: UnionMember3? = null,
private val _json: JsonValue? = null,
) {
@@ -2009,7 +2118,7 @@ private constructor(
fun string(): Optional<String> = Optional.ofNullable(string)
fun json(): Optional<JsonValue> = Optional.ofNullable(json)
fun unionMember3(): Optional<UnionMember3> = Optional.ofNullable(unionMember3)
fun isNumber(): Boolean = number != null
@@ -2017,7 +2126,7 @@ private constructor(
fun isString(): Boolean = string != null
fun isJson(): Boolean = json != null
fun isUnionMember3(): Boolean = unionMember3 != null
fun asNumber(): Double = number.getOrThrow("number")
@@ -2025,7 +2134,7 @@ private constructor(
fun asString(): String = string.getOrThrow("string")
fun asJson(): JsonValue = json.getOrThrow("json")
fun asUnionMember3(): UnionMember3 = unionMember3.getOrThrow("unionMember3")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
@@ -2034,7 +2143,7 @@ private constructor(
number != null -> visitor.visitNumber(number)
bool != null -> visitor.visitBool(bool)
string != null -> visitor.visitString(string)
json != null -> visitor.visitJson(json)
unionMember3 != null -> visitor.visitUnionMember3(unionMember3)
else -> visitor.unknown(_json)
}
@@ -2053,7 +2162,9 @@ private constructor(
override fun visitString(string: String) {}
override fun visitJson(json: JsonValue) {}
override fun visitUnionMember3(unionMember3: UnionMember3) {
unionMember3.validate()
}
}
)
validated = true
@@ -2083,7 +2194,8 @@ private constructor(
override fun visitString(string: String) = 1
override fun visitJson(json: JsonValue) = 1
override fun visitUnionMember3(unionMember3: UnionMember3) =
unionMember3.validity()
override fun unknown(json: JsonValue?) = 0
}
@@ -2098,17 +2210,17 @@ private constructor(
number == other.number &&
bool == other.bool &&
string == other.string &&
json == other.json
unionMember3 == other.unionMember3
}
override fun hashCode(): Int = Objects.hash(number, bool, string, json)
override fun hashCode(): Int = Objects.hash(number, bool, string, unionMember3)
override fun toString(): String =
when {
number != null -> "Value{number=$number}"
bool != null -> "Value{bool=$bool}"
string != null -> "Value{string=$string}"
json != null -> "Value{json=$json}"
unionMember3 != null -> "Value{unionMember3=$unionMember3}"
_json != null -> "Value{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Value")
}
@@ -2121,7 +2233,8 @@ private constructor(
@JvmStatic fun ofString(string: String) = Value(string = string)
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
@JvmStatic
fun ofUnionMember3(unionMember3: UnionMember3) = Value(unionMember3 = unionMember3)
}
/** An interface that defines how to map each variant of [Value] to a value of type [T]. */
@@ -2133,7 +2246,7 @@ private constructor(
fun visitString(string: String): T
fun visitJson(json: JsonValue): T
fun visitUnionMember3(unionMember3: UnionMember3): T
/**
* Maps an unknown variant of [Value] to a value of type [T].
@@ -2157,6 +2270,9 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember3>())?.let {
Value(unionMember3 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Double>())?.let {
Value(number = it, _json = json)
},
@@ -2166,16 +2282,13 @@ private constructor(
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Value(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Value(json = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Value(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -2197,12 +2310,114 @@ private constructor(
value.number != null -> generator.writeObject(value.number)
value.bool != null -> generator.writeObject(value.bool)
value.string != null -> generator.writeObject(value.string)
value.json != null -> generator.writeObject(value.json)
value.unionMember3 != null -> generator.writeObject(value.unionMember3)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Value")
}
}
}
class UnionMember3
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember3]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember3]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember3: UnionMember3) = apply {
additionalProperties = unionMember3.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember3].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember3 = UnionMember3(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember3 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember3 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember3{additionalProperties=$additionalProperties}"
}
}
override fun equals(other: Any?): Boolean {
@@ -22,6 +22,7 @@ import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.allMaxBy
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.getOrThrow
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -39,7 +40,7 @@ private constructor(
private val comparativeExperimentId: JsonField<String>,
private val correction: JsonField<Correction>,
private val createdAt: JsonField<OffsetDateTime>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val feedbackGroupId: JsonField<String>,
private val feedbackSource: JsonField<FeedbackSource>,
private val feedbackThreadId: JsonField<String>,
@@ -67,7 +68,7 @@ private constructor(
@JsonProperty("created_at")
@ExcludeMissing
createdAt: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("feedback_group_id")
@ExcludeMissing
feedbackGroupId: JsonField<String> = JsonMissing.of(),
@@ -146,7 +147,11 @@ private constructor(
*/
fun createdAt(): Optional<OffsetDateTime> = createdAt.getOptional("created_at")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -259,6 +264,13 @@ private constructor(
@ExcludeMissing
fun _createdAt(): JsonField<OffsetDateTime> = createdAt
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [feedbackGroupId].
*
@@ -375,7 +387,7 @@ private constructor(
private var comparativeExperimentId: JsonField<String> = JsonMissing.of()
private var correction: JsonField<Correction> = JsonMissing.of()
private var createdAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var feedbackGroupId: JsonField<String> = JsonMissing.of()
private var feedbackSource: JsonField<FeedbackSource> = JsonMissing.of()
private var feedbackThreadId: JsonField<String> = JsonMissing.of()
@@ -478,8 +490,9 @@ private constructor(
*/
fun correction(correction: JsonField<Correction>) = apply { this.correction = correction }
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = correction(Correction.ofJsonValue(jsonValue))
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) =
correction(Correction.ofUnionMember0(unionMember0))
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = correction(Correction.ofString(string))
@@ -495,7 +508,18 @@ private constructor(
*/
fun createdAt(createdAt: JsonField<OffsetDateTime>) = apply { this.createdAt = createdAt }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun feedbackGroupId(feedbackGroupId: String?) =
feedbackGroupId(JsonField.ofNullable(feedbackGroupId))
@@ -660,8 +684,8 @@ private constructor(
/** Alias for calling [value] with `Value.ofString(string)`. */
fun value(string: String) = value(Value.ofString(string))
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = value(Value.ofJson(json))
/** Alias for calling [value] with `Value.ofUnionMember3(unionMember3)`. */
fun value(unionMember3: Value.UnionMember3) = value(Value.ofUnionMember3(unionMember3))
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
@@ -731,6 +755,7 @@ private constructor(
comparativeExperimentId()
correction().ifPresent { it.validate() }
createdAt()
extra().ifPresent { it.validate() }
feedbackGroupId()
feedbackSource().ifPresent { it.validate() }
feedbackThreadId()
@@ -765,6 +790,7 @@ private constructor(
(if (comparativeExperimentId.asKnown().isPresent) 1 else 0) +
(correction.asKnown().getOrNull()?.validity() ?: 0) +
(if (createdAt.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(if (feedbackGroupId.asKnown().isPresent) 1 else 0) +
(feedbackSource.asKnown().getOrNull()?.validity() ?: 0) +
(if (feedbackThreadId.asKnown().isPresent) 1 else 0) +
@@ -780,20 +806,20 @@ private constructor(
@JsonSerialize(using = Correction.Serializer::class)
class Correction
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val string: String? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun string(): Optional<String> = Optional.ofNullable(string)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isString(): Boolean = string != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asString(): String = string.getOrThrow("string")
@@ -801,7 +827,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
string != null -> visitor.visitString(string)
else -> visitor.unknown(_json)
}
@@ -815,7 +841,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitString(string: String) {}
}
@@ -841,7 +869,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitString(string: String) = 1
@@ -854,14 +883,16 @@ private constructor(
return true
}
return other is Correction && jsonValue == other.jsonValue && string == other.string
return other is Correction &&
unionMember0 == other.unionMember0 &&
string == other.string
}
override fun hashCode(): Int = Objects.hash(jsonValue, string)
override fun hashCode(): Int = Objects.hash(unionMember0, string)
override fun toString(): String =
when {
jsonValue != null -> "Correction{jsonValue=$jsonValue}"
unionMember0 != null -> "Correction{unionMember0=$unionMember0}"
string != null -> "Correction{string=$string}"
_json != null -> "Correction{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Correction")
@@ -869,7 +900,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Correction(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Correction(unionMember0 = unionMember0)
@JvmStatic fun ofString(string: String) = Correction(string = string)
}
@@ -879,7 +911,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitString(string: String): T
@@ -905,19 +937,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Correction(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Correction(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Correction(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Correction(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -936,13 +968,214 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.string != null -> generator.writeObject(value.string)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Correction")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
/** The feedback source loaded from the database. */
@@ -950,7 +1183,7 @@ private constructor(
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val lsUserId: JsonField<String>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val type: JsonField<String>,
private val userId: JsonField<String>,
private val userName: JsonField<String>,
@@ -962,7 +1195,9 @@ private constructor(
@JsonProperty("ls_user_id")
@ExcludeMissing
lsUserId: JsonField<String> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField<String> = JsonMissing.of(),
@JsonProperty("user_id") @ExcludeMissing userId: JsonField<String> = JsonMissing.of(),
@JsonProperty("user_name")
@@ -976,7 +1211,11 @@ private constructor(
*/
fun lsUserId(): Optional<String> = lsUserId.getOptional("ls_user_id")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -1003,6 +1242,13 @@ private constructor(
*/
@JsonProperty("ls_user_id") @ExcludeMissing fun _lsUserId(): JsonField<String> = lsUserId
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [type].
*
@@ -1046,7 +1292,7 @@ private constructor(
class Builder internal constructor() {
private var lsUserId: JsonField<String> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var type: JsonField<String> = JsonMissing.of()
private var userId: JsonField<String> = JsonMissing.of()
private var userName: JsonField<String> = JsonMissing.of()
@@ -1076,7 +1322,19 @@ private constructor(
*/
fun lsUserId(lsUserId: JsonField<String>) = apply { this.lsUserId = lsUserId }
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun type(type: String?) = type(JsonField.ofNullable(type))
@@ -1163,6 +1421,7 @@ private constructor(
}
lsUserId()
metadata().ifPresent { it.validate() }
type()
userId()
userName()
@@ -1186,10 +1445,113 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (lsUserId.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(if (type.asKnown().isPresent) 1 else 0) +
(if (userId.asKnown().isPresent) 1 else 0) +
(if (userName.asKnown().isPresent) 1 else 0)
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -1388,7 +1750,7 @@ private constructor(
private val number: Double? = null,
private val bool: Boolean? = null,
private val string: String? = null,
private val json: JsonValue? = null,
private val unionMember3: UnionMember3? = null,
private val _json: JsonValue? = null,
) {
@@ -1398,7 +1760,7 @@ private constructor(
fun string(): Optional<String> = Optional.ofNullable(string)
fun json(): Optional<JsonValue> = Optional.ofNullable(json)
fun unionMember3(): Optional<UnionMember3> = Optional.ofNullable(unionMember3)
fun isNumber(): Boolean = number != null
@@ -1406,7 +1768,7 @@ private constructor(
fun isString(): Boolean = string != null
fun isJson(): Boolean = json != null
fun isUnionMember3(): Boolean = unionMember3 != null
fun asNumber(): Double = number.getOrThrow("number")
@@ -1414,7 +1776,7 @@ private constructor(
fun asString(): String = string.getOrThrow("string")
fun asJson(): JsonValue = json.getOrThrow("json")
fun asUnionMember3(): UnionMember3 = unionMember3.getOrThrow("unionMember3")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
@@ -1423,7 +1785,7 @@ private constructor(
number != null -> visitor.visitNumber(number)
bool != null -> visitor.visitBool(bool)
string != null -> visitor.visitString(string)
json != null -> visitor.visitJson(json)
unionMember3 != null -> visitor.visitUnionMember3(unionMember3)
else -> visitor.unknown(_json)
}
@@ -1442,7 +1804,9 @@ private constructor(
override fun visitString(string: String) {}
override fun visitJson(json: JsonValue) {}
override fun visitUnionMember3(unionMember3: UnionMember3) {
unionMember3.validate()
}
}
)
validated = true
@@ -1472,7 +1836,8 @@ private constructor(
override fun visitString(string: String) = 1
override fun visitJson(json: JsonValue) = 1
override fun visitUnionMember3(unionMember3: UnionMember3) =
unionMember3.validity()
override fun unknown(json: JsonValue?) = 0
}
@@ -1487,17 +1852,17 @@ private constructor(
number == other.number &&
bool == other.bool &&
string == other.string &&
json == other.json
unionMember3 == other.unionMember3
}
override fun hashCode(): Int = Objects.hash(number, bool, string, json)
override fun hashCode(): Int = Objects.hash(number, bool, string, unionMember3)
override fun toString(): String =
when {
number != null -> "Value{number=$number}"
bool != null -> "Value{bool=$bool}"
string != null -> "Value{string=$string}"
json != null -> "Value{json=$json}"
unionMember3 != null -> "Value{unionMember3=$unionMember3}"
_json != null -> "Value{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Value")
}
@@ -1510,7 +1875,8 @@ private constructor(
@JvmStatic fun ofString(string: String) = Value(string = string)
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
@JvmStatic
fun ofUnionMember3(unionMember3: UnionMember3) = Value(unionMember3 = unionMember3)
}
/** An interface that defines how to map each variant of [Value] to a value of type [T]. */
@@ -1522,7 +1888,7 @@ private constructor(
fun visitString(string: String): T
fun visitJson(json: JsonValue): T
fun visitUnionMember3(unionMember3: UnionMember3): T
/**
* Maps an unknown variant of [Value] to a value of type [T].
@@ -1546,6 +1912,9 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember3>())?.let {
Value(unionMember3 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Double>())?.let {
Value(number = it, _json = json)
},
@@ -1555,16 +1924,13 @@ private constructor(
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Value(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Value(json = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Value(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -1586,12 +1952,114 @@ private constructor(
value.number != null -> generator.writeObject(value.number)
value.bool != null -> generator.writeObject(value.bool)
value.string != null -> generator.writeObject(value.string)
value.json != null -> generator.writeObject(value.json)
value.unionMember3 != null -> generator.writeObject(value.unionMember3)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Value")
}
}
}
class UnionMember3
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember3]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember3]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember3: UnionMember3) = apply {
additionalProperties = unionMember3.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember3].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember3 = UnionMember3(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember3 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember3 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember3{additionalProperties=$additionalProperties}"
}
}
override fun equals(other: Any?): Boolean {
@@ -190,8 +190,10 @@ private constructor(
*/
fun correction(correction: JsonField<Correction>) = apply { body.correction(correction) }
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = apply { body.correction(jsonValue) }
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) = apply {
body.correction(unionMember0)
}
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = apply { body.correction(string) }
@@ -256,8 +258,8 @@ private constructor(
/** Alias for calling [value] with `Value.ofString(string)`. */
fun value(string: String) = apply { body.value(string) }
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = apply { body.value(json) }
/** Alias for calling [value] with `Value.ofUnionMember3(unionMember3)`. */
fun value(unionMember3: Value.UnionMember3) = apply { body.value(unionMember3) }
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
body.additionalProperties(additionalBodyProperties)
@@ -566,8 +568,9 @@ private constructor(
this.correction = correction
}
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = correction(Correction.ofJsonValue(jsonValue))
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) =
correction(Correction.ofUnionMember0(unionMember0))
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = correction(Correction.ofString(string))
@@ -633,8 +636,8 @@ private constructor(
/** Alias for calling [value] with `Value.ofString(string)`. */
fun value(string: String) = value(Value.ofString(string))
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = value(Value.ofJson(json))
/** Alias for calling [value] with `Value.ofUnionMember3(unionMember3)`. */
fun value(unionMember3: Value.UnionMember3) = value(Value.ofUnionMember3(unionMember3))
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
@@ -736,20 +739,20 @@ private constructor(
@JsonSerialize(using = Correction.Serializer::class)
class Correction
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val string: String? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun string(): Optional<String> = Optional.ofNullable(string)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isString(): Boolean = string != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asString(): String = string.getOrThrow("string")
@@ -757,7 +760,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
string != null -> visitor.visitString(string)
else -> visitor.unknown(_json)
}
@@ -771,7 +774,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitString(string: String) {}
}
@@ -797,7 +802,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitString(string: String) = 1
@@ -810,14 +816,16 @@ private constructor(
return true
}
return other is Correction && jsonValue == other.jsonValue && string == other.string
return other is Correction &&
unionMember0 == other.unionMember0 &&
string == other.string
}
override fun hashCode(): Int = Objects.hash(jsonValue, string)
override fun hashCode(): Int = Objects.hash(unionMember0, string)
override fun toString(): String =
when {
jsonValue != null -> "Correction{jsonValue=$jsonValue}"
unionMember0 != null -> "Correction{unionMember0=$unionMember0}"
string != null -> "Correction{string=$string}"
_json != null -> "Correction{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Correction")
@@ -825,7 +833,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Correction(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Correction(unionMember0 = unionMember0)
@JvmStatic fun ofString(string: String) = Correction(string = string)
}
@@ -835,7 +844,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitString(string: String): T
@@ -861,19 +870,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Correction(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Correction(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Correction(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Correction(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -892,13 +901,115 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.string != null -> generator.writeObject(value.string)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Correction")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
class FeedbackConfig
@@ -1709,7 +1820,7 @@ private constructor(
private val number: Double? = null,
private val bool: Boolean? = null,
private val string: String? = null,
private val json: JsonValue? = null,
private val unionMember3: UnionMember3? = null,
private val _json: JsonValue? = null,
) {
@@ -1719,7 +1830,7 @@ private constructor(
fun string(): Optional<String> = Optional.ofNullable(string)
fun json(): Optional<JsonValue> = Optional.ofNullable(json)
fun unionMember3(): Optional<UnionMember3> = Optional.ofNullable(unionMember3)
fun isNumber(): Boolean = number != null
@@ -1727,7 +1838,7 @@ private constructor(
fun isString(): Boolean = string != null
fun isJson(): Boolean = json != null
fun isUnionMember3(): Boolean = unionMember3 != null
fun asNumber(): Double = number.getOrThrow("number")
@@ -1735,7 +1846,7 @@ private constructor(
fun asString(): String = string.getOrThrow("string")
fun asJson(): JsonValue = json.getOrThrow("json")
fun asUnionMember3(): UnionMember3 = unionMember3.getOrThrow("unionMember3")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
@@ -1744,7 +1855,7 @@ private constructor(
number != null -> visitor.visitNumber(number)
bool != null -> visitor.visitBool(bool)
string != null -> visitor.visitString(string)
json != null -> visitor.visitJson(json)
unionMember3 != null -> visitor.visitUnionMember3(unionMember3)
else -> visitor.unknown(_json)
}
@@ -1763,7 +1874,9 @@ private constructor(
override fun visitString(string: String) {}
override fun visitJson(json: JsonValue) {}
override fun visitUnionMember3(unionMember3: UnionMember3) {
unionMember3.validate()
}
}
)
validated = true
@@ -1793,7 +1906,8 @@ private constructor(
override fun visitString(string: String) = 1
override fun visitJson(json: JsonValue) = 1
override fun visitUnionMember3(unionMember3: UnionMember3) =
unionMember3.validity()
override fun unknown(json: JsonValue?) = 0
}
@@ -1808,17 +1922,17 @@ private constructor(
number == other.number &&
bool == other.bool &&
string == other.string &&
json == other.json
unionMember3 == other.unionMember3
}
override fun hashCode(): Int = Objects.hash(number, bool, string, json)
override fun hashCode(): Int = Objects.hash(number, bool, string, unionMember3)
override fun toString(): String =
when {
number != null -> "Value{number=$number}"
bool != null -> "Value{bool=$bool}"
string != null -> "Value{string=$string}"
json != null -> "Value{json=$json}"
unionMember3 != null -> "Value{unionMember3=$unionMember3}"
_json != null -> "Value{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Value")
}
@@ -1831,7 +1945,8 @@ private constructor(
@JvmStatic fun ofString(string: String) = Value(string = string)
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
@JvmStatic
fun ofUnionMember3(unionMember3: UnionMember3) = Value(unionMember3 = unionMember3)
}
/** An interface that defines how to map each variant of [Value] to a value of type [T]. */
@@ -1843,7 +1958,7 @@ private constructor(
fun visitString(string: String): T
fun visitJson(json: JsonValue): T
fun visitUnionMember3(unionMember3: UnionMember3): T
/**
* Maps an unknown variant of [Value] to a value of type [T].
@@ -1867,6 +1982,9 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember3>())?.let {
Value(unionMember3 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Double>())?.let {
Value(number = it, _json = json)
},
@@ -1876,16 +1994,13 @@ private constructor(
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Value(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Value(json = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Value(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -1907,12 +2022,114 @@ private constructor(
value.number != null -> generator.writeObject(value.number)
value.bool != null -> generator.writeObject(value.bool)
value.string != null -> generator.writeObject(value.string)
value.json != null -> generator.writeObject(value.json)
value.unionMember3 != null -> generator.writeObject(value.unionMember3)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Value")
}
}
}
class UnionMember3
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember3]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember3]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember3: UnionMember3) = apply {
additionalProperties = unionMember3.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember3].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember3 = UnionMember3(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember3 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember3 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember3{additionalProperties=$additionalProperties}"
}
}
override fun equals(other: Any?): Boolean {
@@ -11,6 +11,7 @@ import com.langchain.smith.core.ExcludeMissing
import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -21,18 +22,22 @@ import kotlin.jvm.optionals.getOrNull
class ModelFeedbackSource
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val type: JsonField<Type>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@JsonCreator
private constructor(
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("type") @ExcludeMissing type: JsonField<Type> = JsonMissing.of(),
) : this(metadata, type, mutableMapOf())
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -40,6 +45,13 @@ private constructor(
*/
fun type(): Optional<Type> = type.getOptional("type")
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [type].
*
@@ -68,7 +80,7 @@ private constructor(
/** A builder for [ModelFeedbackSource]. */
class Builder internal constructor() {
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var type: JsonField<Type> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -79,7 +91,19 @@ private constructor(
additionalProperties = modelFeedbackSource.additionalProperties.toMutableMap()
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun type(type: Type) = type(JsonField.of(type))
@@ -126,6 +150,7 @@ private constructor(
return@apply
}
metadata().ifPresent { it.validate() }
type().ifPresent { it.validate() }
validated = true
}
@@ -143,7 +168,109 @@ private constructor(
*
* Used for best match union deserialization.
*/
@JvmSynthetic internal fun validity(): Int = (type.asKnown().getOrNull()?.validity() ?: 0)
@JvmSynthetic
internal fun validity(): Int =
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(type.asKnown().getOrNull()?.validity() ?: 0)
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
@@ -24,6 +24,7 @@ import com.langchain.smith.core.allMaxBy
import com.langchain.smith.core.getOrThrow
import com.langchain.smith.core.http.Headers
import com.langchain.smith.core.http.QueryParams
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Collections
import java.util.Objects
@@ -53,7 +54,11 @@ private constructor(
*/
fun correction(): Optional<Correction> = body.correction()
fun _metadata(): JsonValue = body._metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = body.metadata()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -81,6 +86,13 @@ private constructor(
*/
fun _correction(): JsonField<Correction> = body._correction()
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _metadata(): JsonField<Metadata> = body._metadata()
/**
* Returns the raw JSON value of [score].
*
@@ -175,13 +187,27 @@ private constructor(
*/
fun correction(correction: JsonField<Correction>) = apply { body.correction(correction) }
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = apply { body.correction(jsonValue) }
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) = apply {
body.correction(unionMember0)
}
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = apply { body.correction(string) }
fun metadata(metadata: JsonValue) = apply { body.metadata(metadata) }
fun metadata(metadata: Metadata?) = apply { body.metadata(metadata) }
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { body.metadata(metadata) }
fun score(score: Score?) = apply { body.score(score) }
@@ -373,7 +399,7 @@ private constructor(
private constructor(
private val comment: JsonField<String>,
private val correction: JsonField<Correction>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val score: JsonField<Score>,
private val value: JsonField<Value>,
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -385,7 +411,9 @@ private constructor(
@JsonProperty("correction")
@ExcludeMissing
correction: JsonField<Correction> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("score") @ExcludeMissing score: JsonField<Score> = JsonMissing.of(),
@JsonProperty("value") @ExcludeMissing value: JsonField<Value> = JsonMissing.of(),
) : this(comment, correction, metadata, score, value, mutableMapOf())
@@ -402,7 +430,11 @@ private constructor(
*/
fun correction(): Optional<Correction> = correction.getOptional("correction")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -432,6 +464,13 @@ private constructor(
@ExcludeMissing
fun _correction(): JsonField<Correction> = correction
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [score].
*
@@ -469,7 +508,7 @@ private constructor(
private var comment: JsonField<String> = JsonMissing.of()
private var correction: JsonField<Correction> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var score: JsonField<Score> = JsonMissing.of()
private var value: JsonField<Value> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -514,13 +553,26 @@ private constructor(
this.correction = correction
}
/** Alias for calling [correction] with `Correction.ofJsonValue(jsonValue)`. */
fun correction(jsonValue: JsonValue) = correction(Correction.ofJsonValue(jsonValue))
/** Alias for calling [correction] with `Correction.ofUnionMember0(unionMember0)`. */
fun correction(unionMember0: Correction.UnionMember0) =
correction(Correction.ofUnionMember0(unionMember0))
/** Alias for calling [correction] with `Correction.ofString(string)`. */
fun correction(string: String) = correction(Correction.ofString(string))
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun score(score: Score?) = score(JsonField.ofNullable(score))
@@ -609,6 +661,7 @@ private constructor(
comment()
correction().ifPresent { it.validate() }
metadata().ifPresent { it.validate() }
score().ifPresent { it.validate() }
value().ifPresent { it.validate() }
validated = true
@@ -632,6 +685,7 @@ private constructor(
internal fun validity(): Int =
(if (comment.asKnown().isPresent) 1 else 0) +
(correction.asKnown().getOrNull()?.validity() ?: 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(score.asKnown().getOrNull()?.validity() ?: 0) +
(value.asKnown().getOrNull()?.validity() ?: 0)
@@ -663,20 +717,20 @@ private constructor(
@JsonSerialize(using = Correction.Serializer::class)
class Correction
private constructor(
private val jsonValue: JsonValue? = null,
private val unionMember0: UnionMember0? = null,
private val string: String? = null,
private val _json: JsonValue? = null,
) {
fun jsonValue(): Optional<JsonValue> = Optional.ofNullable(jsonValue)
fun unionMember0(): Optional<UnionMember0> = Optional.ofNullable(unionMember0)
fun string(): Optional<String> = Optional.ofNullable(string)
fun isJsonValue(): Boolean = jsonValue != null
fun isUnionMember0(): Boolean = unionMember0 != null
fun isString(): Boolean = string != null
fun asJsonValue(): JsonValue = jsonValue.getOrThrow("jsonValue")
fun asUnionMember0(): UnionMember0 = unionMember0.getOrThrow("unionMember0")
fun asString(): String = string.getOrThrow("string")
@@ -684,7 +738,7 @@ private constructor(
fun <T> accept(visitor: Visitor<T>): T =
when {
jsonValue != null -> visitor.visitJsonValue(jsonValue)
unionMember0 != null -> visitor.visitUnionMember0(unionMember0)
string != null -> visitor.visitString(string)
else -> visitor.unknown(_json)
}
@@ -698,7 +752,9 @@ private constructor(
accept(
object : Visitor<Unit> {
override fun visitJsonValue(jsonValue: JsonValue) {}
override fun visitUnionMember0(unionMember0: UnionMember0) {
unionMember0.validate()
}
override fun visitString(string: String) {}
}
@@ -724,7 +780,8 @@ private constructor(
internal fun validity(): Int =
accept(
object : Visitor<Int> {
override fun visitJsonValue(jsonValue: JsonValue) = 1
override fun visitUnionMember0(unionMember0: UnionMember0) =
unionMember0.validity()
override fun visitString(string: String) = 1
@@ -737,14 +794,16 @@ private constructor(
return true
}
return other is Correction && jsonValue == other.jsonValue && string == other.string
return other is Correction &&
unionMember0 == other.unionMember0 &&
string == other.string
}
override fun hashCode(): Int = Objects.hash(jsonValue, string)
override fun hashCode(): Int = Objects.hash(unionMember0, string)
override fun toString(): String =
when {
jsonValue != null -> "Correction{jsonValue=$jsonValue}"
unionMember0 != null -> "Correction{unionMember0=$unionMember0}"
string != null -> "Correction{string=$string}"
_json != null -> "Correction{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Correction")
@@ -752,7 +811,8 @@ private constructor(
companion object {
@JvmStatic fun ofJsonValue(jsonValue: JsonValue) = Correction(jsonValue = jsonValue)
@JvmStatic
fun ofUnionMember0(unionMember0: UnionMember0) = Correction(unionMember0 = unionMember0)
@JvmStatic fun ofString(string: String) = Correction(string = string)
}
@@ -762,7 +822,7 @@ private constructor(
*/
interface Visitor<out T> {
fun visitJsonValue(jsonValue: JsonValue): T
fun visitUnionMember0(unionMember0: UnionMember0): T
fun visitString(string: String): T
@@ -788,19 +848,19 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember0>())?.let {
Correction(unionMember0 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<String>())?.let {
Correction(string = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Correction(jsonValue = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely incompatible with
// all the possible variants.
// all the possible variants (e.g. deserializing from array).
0 -> Correction(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use the first
@@ -819,13 +879,214 @@ private constructor(
provider: SerializerProvider,
) {
when {
value.jsonValue != null -> generator.writeObject(value.jsonValue)
value.unionMember0 != null -> generator.writeObject(value.unionMember0)
value.string != null -> generator.writeObject(value.string)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Correction")
}
}
}
class UnionMember0
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [UnionMember0]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember0]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(unionMember0: UnionMember0) = apply {
additionalProperties = unionMember0.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember0].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember0 = UnionMember0(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember0 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember0 && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "UnionMember0{additionalProperties=$additionalProperties}"
}
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
@JsonDeserialize(using = Score.Deserializer::class)
@@ -30,8 +30,8 @@ private constructor(
private val experimentsInfo: JsonField<List<SimpleExperimentInfo>>,
private val modifiedAt: JsonField<OffsetDateTime>,
private val description: JsonField<String>,
private val extra: JsonValue,
private val feedbackStats: JsonValue,
private val extra: JsonField<Extra>,
private val feedbackStats: JsonField<FeedbackStats>,
private val name: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -51,8 +51,10 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField<String> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("feedback_stats") @ExcludeMissing feedbackStats: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("feedback_stats")
@ExcludeMissing
feedbackStats: JsonField<FeedbackStats> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
) : this(
id,
@@ -97,9 +99,17 @@ private constructor(
*/
fun description(): Optional<String> = description.getOptional("description")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
@JsonProperty("feedback_stats") @ExcludeMissing fun _feedbackStats(): JsonValue = feedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun feedbackStats(): Optional<FeedbackStats> = feedbackStats.getOptional("feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -148,6 +158,22 @@ private constructor(
*/
@JsonProperty("description") @ExcludeMissing fun _description(): JsonField<String> = description
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [feedbackStats].
*
* Unlike [feedbackStats], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonField<FeedbackStats> = feedbackStats
/**
* Returns the raw JSON value of [name].
*
@@ -192,8 +218,8 @@ private constructor(
private var experimentsInfo: JsonField<MutableList<SimpleExperimentInfo>>? = null
private var modifiedAt: JsonField<OffsetDateTime>? = null
private var description: JsonField<String> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var feedbackStats: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var feedbackStats: JsonField<FeedbackStats> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -286,9 +312,36 @@ private constructor(
*/
fun description(description: JsonField<String>) = apply { this.description = description }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
fun feedbackStats(feedbackStats: JsonValue) = apply { this.feedbackStats = feedbackStats }
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun feedbackStats(feedbackStats: FeedbackStats?) =
feedbackStats(JsonField.ofNullable(feedbackStats))
/** Alias for calling [Builder.feedbackStats] with `feedbackStats.orElse(null)`. */
fun feedbackStats(feedbackStats: Optional<FeedbackStats>) =
feedbackStats(feedbackStats.getOrNull())
/**
* Sets [Builder.feedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.feedbackStats] with a well-typed [FeedbackStats] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun feedbackStats(feedbackStats: JsonField<FeedbackStats>) = apply {
this.feedbackStats = feedbackStats
}
fun name(name: String?) = name(JsonField.ofNullable(name))
@@ -363,6 +416,8 @@ private constructor(
experimentsInfo().forEach { it.validate() }
modifiedAt()
description()
extra().ifPresent { it.validate() }
feedbackStats().ifPresent { it.validate() }
name()
validated = true
}
@@ -387,8 +442,208 @@ private constructor(
(experimentsInfo.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (modifiedAt.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(feedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0)
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class FeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [FeedbackStats]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [FeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(feedbackStats: FeedbackStats) = apply {
additionalProperties = feedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [FeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): FeedbackStats = FeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): FeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is FeedbackStats && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "FeedbackStats{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -38,8 +38,8 @@ private constructor(
private val dataType: JsonField<DataType>,
private val description: JsonField<String>,
private val externallyManaged: JsonField<Boolean>,
private val inputsSchemaDefinition: JsonValue,
private val outputsSchemaDefinition: JsonValue,
private val inputsSchemaDefinition: JsonField<InputsSchemaDefinition>,
private val outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>,
private val transformations: JsonField<List<DatasetTransformation>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -63,10 +63,10 @@ private constructor(
externallyManaged: JsonField<Boolean> = JsonMissing.of(),
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
inputsSchemaDefinition: JsonValue = JsonMissing.of(),
inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
outputsSchemaDefinition: JsonValue = JsonMissing.of(),
outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of(),
@JsonProperty("transformations")
@ExcludeMissing
transformations: JsonField<List<DatasetTransformation>> = JsonMissing.of(),
@@ -128,13 +128,19 @@ private constructor(
*/
fun externallyManaged(): Optional<Boolean> = externallyManaged.getOptional("externally_managed")
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonValue = inputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun inputsSchemaDefinition(): Optional<InputsSchemaDefinition> =
inputsSchemaDefinition.getOptional("inputs_schema_definition")
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonValue = outputsSchemaDefinition
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun outputsSchemaDefinition(): Optional<OutputsSchemaDefinition> =
outputsSchemaDefinition.getOptional("outputs_schema_definition")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -199,6 +205,26 @@ private constructor(
@ExcludeMissing
fun _externallyManaged(): JsonField<Boolean> = externallyManaged
/**
* Returns the raw JSON value of [inputsSchemaDefinition].
*
* Unlike [inputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("inputs_schema_definition")
@ExcludeMissing
fun _inputsSchemaDefinition(): JsonField<InputsSchemaDefinition> = inputsSchemaDefinition
/**
* Returns the raw JSON value of [outputsSchemaDefinition].
*
* Unlike [outputsSchemaDefinition], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("outputs_schema_definition")
@ExcludeMissing
fun _outputsSchemaDefinition(): JsonField<OutputsSchemaDefinition> = outputsSchemaDefinition
/**
* Returns the raw JSON value of [transformations].
*
@@ -245,8 +271,8 @@ private constructor(
private var dataType: JsonField<DataType> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var externallyManaged: JsonField<Boolean> = JsonMissing.of()
private var inputsSchemaDefinition: JsonValue = JsonMissing.of()
private var outputsSchemaDefinition: JsonValue = JsonMissing.of()
private var inputsSchemaDefinition: JsonField<InputsSchemaDefinition> = JsonMissing.of()
private var outputsSchemaDefinition: JsonField<OutputsSchemaDefinition> = JsonMissing.of()
private var transformations: JsonField<MutableList<DatasetTransformation>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -362,13 +388,49 @@ private constructor(
this.externallyManaged = externallyManaged
}
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonValue) = apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun inputsSchemaDefinition(inputsSchemaDefinition: InputsSchemaDefinition?) =
inputsSchemaDefinition(JsonField.ofNullable(inputsSchemaDefinition))
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonValue) = apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
/**
* Alias for calling [Builder.inputsSchemaDefinition] with
* `inputsSchemaDefinition.orElse(null)`.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: Optional<InputsSchemaDefinition>) =
inputsSchemaDefinition(inputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.inputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.inputsSchemaDefinition] with a well-typed
* [InputsSchemaDefinition] value instead. This method is primarily for setting the field to
* an undocumented or not yet supported value.
*/
fun inputsSchemaDefinition(inputsSchemaDefinition: JsonField<InputsSchemaDefinition>) =
apply {
this.inputsSchemaDefinition = inputsSchemaDefinition
}
fun outputsSchemaDefinition(outputsSchemaDefinition: OutputsSchemaDefinition?) =
outputsSchemaDefinition(JsonField.ofNullable(outputsSchemaDefinition))
/**
* Alias for calling [Builder.outputsSchemaDefinition] with
* `outputsSchemaDefinition.orElse(null)`.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: Optional<OutputsSchemaDefinition>) =
outputsSchemaDefinition(outputsSchemaDefinition.getOrNull())
/**
* Sets [Builder.outputsSchemaDefinition] to an arbitrary JSON value.
*
* You should usually call [Builder.outputsSchemaDefinition] with a well-typed
* [OutputsSchemaDefinition] value instead. This method is primarily for setting the field
* to an undocumented or not yet supported value.
*/
fun outputsSchemaDefinition(outputsSchemaDefinition: JsonField<OutputsSchemaDefinition>) =
apply {
this.outputsSchemaDefinition = outputsSchemaDefinition
}
fun transformations(transformations: List<DatasetTransformation>?) =
transformations(JsonField.ofNullable(transformations))
@@ -463,6 +525,8 @@ private constructor(
dataType().ifPresent { it.validate() }
description()
externallyManaged()
inputsSchemaDefinition().ifPresent { it.validate() }
outputsSchemaDefinition().ifPresent { it.validate() }
transformations().ifPresent { it.forEach { it.validate() } }
validated = true
}
@@ -489,8 +553,218 @@ private constructor(
(dataType.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (externallyManaged.asKnown().isPresent) 1 else 0) +
(inputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(outputsSchemaDefinition.asKnown().getOrNull()?.validity() ?: 0) +
(transformations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
class InputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [InputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [InputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(inputsSchemaDefinition: InputsSchemaDefinition) = apply {
additionalProperties = inputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [InputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): InputsSchemaDefinition =
InputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): InputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is InputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"InputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
class OutputsSchemaDefinition
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [OutputsSchemaDefinition].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [OutputsSchemaDefinition]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(outputsSchemaDefinition: OutputsSchemaDefinition) = apply {
additionalProperties = outputsSchemaDefinition.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [OutputsSchemaDefinition].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): OutputsSchemaDefinition =
OutputsSchemaDefinition(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): OutputsSchemaDefinition = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is OutputsSchemaDefinition &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"OutputsSchemaDefinition{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -22,9 +22,9 @@ import kotlin.jvm.optionals.getOrNull
class DemoConfig
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val examples: JsonField<List<JsonValue>>,
private val examples: JsonField<List<Example>>,
private val messageIndex: JsonField<Long>,
private val metaprompt: JsonValue,
private val metaprompt: JsonField<Metaprompt>,
private val overallFeedback: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -33,11 +33,13 @@ private constructor(
private constructor(
@JsonProperty("examples")
@ExcludeMissing
examples: JsonField<List<JsonValue>> = JsonMissing.of(),
examples: JsonField<List<Example>> = JsonMissing.of(),
@JsonProperty("message_index")
@ExcludeMissing
messageIndex: JsonField<Long> = JsonMissing.of(),
@JsonProperty("metaprompt") @ExcludeMissing metaprompt: JsonValue = JsonMissing.of(),
@JsonProperty("metaprompt")
@ExcludeMissing
metaprompt: JsonField<Metaprompt> = JsonMissing.of(),
@JsonProperty("overall_feedback")
@ExcludeMissing
overallFeedback: JsonField<String> = JsonMissing.of(),
@@ -47,7 +49,7 @@ private constructor(
* @throws LangChainInvalidDataException 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 examples(): List<JsonValue> = examples.getRequired("examples")
fun examples(): List<Example> = examples.getRequired("examples")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -55,7 +57,11 @@ private constructor(
*/
fun messageIndex(): Long = messageIndex.getRequired("message_index")
@JsonProperty("metaprompt") @ExcludeMissing fun _metaprompt(): JsonValue = metaprompt
/**
* @throws LangChainInvalidDataException 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 metaprompt(): Metaprompt = metaprompt.getRequired("metaprompt")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -68,7 +74,7 @@ private constructor(
*
* Unlike [examples], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("examples") @ExcludeMissing fun _examples(): JsonField<List<JsonValue>> = examples
@JsonProperty("examples") @ExcludeMissing fun _examples(): JsonField<List<Example>> = examples
/**
* Returns the raw JSON value of [messageIndex].
@@ -79,6 +85,15 @@ private constructor(
@ExcludeMissing
fun _messageIndex(): JsonField<Long> = messageIndex
/**
* Returns the raw JSON value of [metaprompt].
*
* Unlike [metaprompt], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metaprompt")
@ExcludeMissing
fun _metaprompt(): JsonField<Metaprompt> = metaprompt
/**
* Returns the raw JSON value of [overallFeedback].
*
@@ -119,9 +134,9 @@ private constructor(
/** A builder for [DemoConfig]. */
class Builder internal constructor() {
private var examples: JsonField<MutableList<JsonValue>>? = null
private var examples: JsonField<MutableList<Example>>? = null
private var messageIndex: JsonField<Long>? = null
private var metaprompt: JsonValue? = null
private var metaprompt: JsonField<Metaprompt>? = null
private var overallFeedback: JsonField<String>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -134,25 +149,25 @@ private constructor(
additionalProperties = demoConfig.additionalProperties.toMutableMap()
}
fun examples(examples: List<JsonValue>) = examples(JsonField.of(examples))
fun examples(examples: List<Example>) = examples(JsonField.of(examples))
/**
* Sets [Builder.examples] to an arbitrary JSON value.
*
* You should usually call [Builder.examples] with a well-typed `List<JsonValue>` value
* You should usually call [Builder.examples] with a well-typed `List<Example>` value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun examples(examples: JsonField<List<JsonValue>>) = apply {
fun examples(examples: JsonField<List<Example>>) = apply {
this.examples = examples.map { it.toMutableList() }
}
/**
* Adds a single [JsonValue] to [examples].
* Adds a single [Example] to [examples].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
fun addExample(example: JsonValue) = apply {
fun addExample(example: Example) = apply {
examples =
(examples ?: JsonField.of(mutableListOf())).also {
checkKnown("examples", it).add(example)
@@ -170,7 +185,16 @@ private constructor(
*/
fun messageIndex(messageIndex: JsonField<Long>) = apply { this.messageIndex = messageIndex }
fun metaprompt(metaprompt: JsonValue) = apply { this.metaprompt = metaprompt }
fun metaprompt(metaprompt: Metaprompt) = metaprompt(JsonField.of(metaprompt))
/**
* Sets [Builder.metaprompt] to an arbitrary JSON value.
*
* You should usually call [Builder.metaprompt] with a well-typed [Metaprompt] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metaprompt(metaprompt: JsonField<Metaprompt>) = apply { this.metaprompt = metaprompt }
fun overallFeedback(overallFeedback: String?) =
overallFeedback(JsonField.ofNullable(overallFeedback))
@@ -241,8 +265,9 @@ private constructor(
return@apply
}
examples()
examples().forEach { it.validate() }
messageIndex()
metaprompt().validate()
overallFeedback()
validated = true
}
@@ -262,10 +287,209 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(examples.asKnown().getOrNull()?.size ?: 0) +
(examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (messageIndex.asKnown().isPresent) 1 else 0) +
(metaprompt.asKnown().getOrNull()?.validity() ?: 0) +
(if (overallFeedback.asKnown().isPresent) 1 else 0)
class Example
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Example]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Example]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(example: Example) = apply {
additionalProperties = example.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Example].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Example = Example(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Example = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Example && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Example{additionalProperties=$additionalProperties}"
}
class Metaprompt
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metaprompt]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metaprompt]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metaprompt: Metaprompt) = apply {
additionalProperties = metaprompt.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metaprompt].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metaprompt = Metaprompt(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metaprompt = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metaprompt && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metaprompt{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -424,7 +424,7 @@ private constructor(
private val title: JsonField<String>,
private val commonFilters: JsonField<CommonFilters>,
private val description: JsonField<String>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -446,7 +446,9 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField<String> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
) : this(
id,
chartType,
@@ -510,7 +512,11 @@ private constructor(
*/
fun description(): Optional<String> = description.getOptional("description")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* Returns the raw JSON value of [id].
@@ -575,6 +581,13 @@ private constructor(
@ExcludeMissing
fun _description(): JsonField<String> = description
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -616,7 +629,7 @@ private constructor(
private var title: JsonField<String>? = null
private var commonFilters: JsonField<CommonFilters> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
@@ -762,7 +775,19 @@ private constructor(
this.description = description
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
@@ -830,6 +855,7 @@ private constructor(
title()
commonFilters().ifPresent { it.validate() }
description()
metadata().ifPresent { it.validate() }
validated = true
}
@@ -856,7 +882,8 @@ private constructor(
(series.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (title.asKnown().isPresent) 1 else 0) +
(commonFilters.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0)
(if (description.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0)
/** Enum for custom chart types. */
class ChartType @JsonCreator private constructor(private val value: JsonField<String>) :
@@ -1156,8 +1183,9 @@ private constructor(
/** Alias for calling [value] with `Value.ofNumber(number)`. */
fun value(number: Double) = value(Value.ofNumber(number))
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = value(Value.ofJson(json))
/** Alias for calling [value] with `Value.ofUnionMember1(unionMember1)`. */
fun value(unionMember1: Value.UnionMember1) =
value(Value.ofUnionMember1(unionMember1))
fun group(group: String?) = group(JsonField.ofNullable(group))
@@ -1259,28 +1287,28 @@ private constructor(
class Value
private constructor(
private val number: Double? = null,
private val json: JsonValue? = null,
private val unionMember1: UnionMember1? = null,
private val _json: JsonValue? = null,
) {
fun number(): Optional<Double> = Optional.ofNullable(number)
fun json(): Optional<JsonValue> = Optional.ofNullable(json)
fun unionMember1(): Optional<UnionMember1> = Optional.ofNullable(unionMember1)
fun isNumber(): Boolean = number != null
fun isJson(): Boolean = json != null
fun isUnionMember1(): Boolean = unionMember1 != null
fun asNumber(): Double = number.getOrThrow("number")
fun asJson(): JsonValue = json.getOrThrow("json")
fun asUnionMember1(): UnionMember1 = unionMember1.getOrThrow("unionMember1")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
fun <T> accept(visitor: Visitor<T>): T =
when {
number != null -> visitor.visitNumber(number)
json != null -> visitor.visitJson(json)
unionMember1 != null -> visitor.visitUnionMember1(unionMember1)
else -> visitor.unknown(_json)
}
@@ -1295,7 +1323,9 @@ private constructor(
object : Visitor<Unit> {
override fun visitNumber(number: Double) {}
override fun visitJson(json: JsonValue) {}
override fun visitUnionMember1(unionMember1: UnionMember1) {
unionMember1.validate()
}
}
)
validated = true
@@ -1321,7 +1351,8 @@ private constructor(
object : Visitor<Int> {
override fun visitNumber(number: Double) = 1
override fun visitJson(json: JsonValue) = 1
override fun visitUnionMember1(unionMember1: UnionMember1) =
unionMember1.validity()
override fun unknown(json: JsonValue?) = 0
}
@@ -1332,15 +1363,17 @@ private constructor(
return true
}
return other is Value && number == other.number && json == other.json
return other is Value &&
number == other.number &&
unionMember1 == other.unionMember1
}
override fun hashCode(): Int = Objects.hash(number, json)
override fun hashCode(): Int = Objects.hash(number, unionMember1)
override fun toString(): String =
when {
number != null -> "Value{number=$number}"
json != null -> "Value{json=$json}"
unionMember1 != null -> "Value{unionMember1=$unionMember1}"
_json != null -> "Value{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Value")
}
@@ -1349,7 +1382,9 @@ private constructor(
@JvmStatic fun ofNumber(number: Double) = Value(number = number)
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
@JvmStatic
fun ofUnionMember1(unionMember1: UnionMember1) =
Value(unionMember1 = unionMember1)
}
/**
@@ -1360,7 +1395,7 @@ private constructor(
fun visitNumber(number: Double): T
fun visitJson(json: JsonValue): T
fun visitUnionMember1(unionMember1: UnionMember1): T
/**
* Maps an unknown variant of [Value] to a value of type [T].
@@ -1384,19 +1419,20 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember1>())?.let {
Value(unionMember1 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Double>())?.let {
Value(number = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Value(json = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely
// incompatible with all the possible variants.
// incompatible with all the possible variants (e.g. deserializing from
// boolean).
0 -> Value(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then use
@@ -1416,12 +1452,121 @@ private constructor(
) {
when {
value.number != null -> generator.writeObject(value.number)
value.json != null -> generator.writeObject(value.json)
value.unionMember1 != null -> generator.writeObject(value.unionMember1)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Value")
}
}
}
class UnionMember1
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [UnionMember1].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember1]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> =
mutableMapOf()
@JvmSynthetic
internal fun from(unionMember1: UnionMember1) = apply {
additionalProperties = unionMember1.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(
additionalProperties: Map<String, JsonValue>
) = apply { this.additionalProperties.putAll(additionalProperties) }
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember1].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): UnionMember1 = UnionMember1(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember1 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember1 &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"UnionMember1{additionalProperties=$additionalProperties}"
}
}
override fun equals(other: Any?): Boolean {
@@ -3533,6 +3678,108 @@ private constructor(
"CommonFilters{filter=$filter, session=$session, traceFilter=$traceFilter, treeFilter=$treeFilter, additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -3878,7 +4125,7 @@ private constructor(
private val title: JsonField<String>,
private val commonFilters: JsonField<CommonFilters>,
private val description: JsonField<String>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -3902,7 +4149,9 @@ private constructor(
@JsonProperty("description")
@ExcludeMissing
description: JsonField<String> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata")
@ExcludeMissing
metadata: JsonField<Metadata> = JsonMissing.of(),
) : this(
id,
chartType,
@@ -3973,7 +4222,11 @@ private constructor(
*/
fun description(): Optional<String> = description.getOptional("description")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* Returns the raw JSON value of [id].
@@ -4040,6 +4293,16 @@ private constructor(
@ExcludeMissing
fun _description(): JsonField<String> = description
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected
* type.
*/
@JsonProperty("metadata")
@ExcludeMissing
fun _metadata(): JsonField<Metadata> = metadata
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -4081,7 +4344,7 @@ private constructor(
private var title: JsonField<String>? = null
private var commonFilters: JsonField<CommonFilters> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
@@ -4231,7 +4494,19 @@ private constructor(
this.description = description
}
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value
* instead. This method is primarily for setting the field to an undocumented or not
* yet supported value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
@@ -4302,6 +4577,7 @@ private constructor(
title()
commonFilters().ifPresent { it.validate() }
description()
metadata().ifPresent { it.validate() }
validated = true
}
@@ -4328,7 +4604,8 @@ private constructor(
(series.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(if (title.asKnown().isPresent) 1 else 0) +
(commonFilters.asKnown().getOrNull()?.validity() ?: 0) +
(if (description.asKnown().isPresent) 1 else 0)
(if (description.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0)
/** Enum for custom chart types. */
class ChartType @JsonCreator private constructor(private val value: JsonField<String>) :
@@ -4636,8 +4913,9 @@ private constructor(
/** Alias for calling [value] with `Value.ofNumber(number)`. */
fun value(number: Double) = value(Value.ofNumber(number))
/** Alias for calling [value] with `Value.ofJson(json)`. */
fun value(json: JsonValue) = value(Value.ofJson(json))
/** Alias for calling [value] with `Value.ofUnionMember1(unionMember1)`. */
fun value(unionMember1: Value.UnionMember1) =
value(Value.ofUnionMember1(unionMember1))
fun group(group: String?) = group(JsonField.ofNullable(group))
@@ -4739,28 +5017,28 @@ private constructor(
class Value
private constructor(
private val number: Double? = null,
private val json: JsonValue? = null,
private val unionMember1: UnionMember1? = null,
private val _json: JsonValue? = null,
) {
fun number(): Optional<Double> = Optional.ofNullable(number)
fun json(): Optional<JsonValue> = Optional.ofNullable(json)
fun unionMember1(): Optional<UnionMember1> = Optional.ofNullable(unionMember1)
fun isNumber(): Boolean = number != null
fun isJson(): Boolean = json != null
fun isUnionMember1(): Boolean = unionMember1 != null
fun asNumber(): Double = number.getOrThrow("number")
fun asJson(): JsonValue = json.getOrThrow("json")
fun asUnionMember1(): UnionMember1 = unionMember1.getOrThrow("unionMember1")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
fun <T> accept(visitor: Visitor<T>): T =
when {
number != null -> visitor.visitNumber(number)
json != null -> visitor.visitJson(json)
unionMember1 != null -> visitor.visitUnionMember1(unionMember1)
else -> visitor.unknown(_json)
}
@@ -4775,7 +5053,9 @@ private constructor(
object : Visitor<Unit> {
override fun visitNumber(number: Double) {}
override fun visitJson(json: JsonValue) {}
override fun visitUnionMember1(unionMember1: UnionMember1) {
unionMember1.validate()
}
}
)
validated = true
@@ -4801,7 +5081,8 @@ private constructor(
object : Visitor<Int> {
override fun visitNumber(number: Double) = 1
override fun visitJson(json: JsonValue) = 1
override fun visitUnionMember1(unionMember1: UnionMember1) =
unionMember1.validity()
override fun unknown(json: JsonValue?) = 0
}
@@ -4812,15 +5093,17 @@ private constructor(
return true
}
return other is Value && number == other.number && json == other.json
return other is Value &&
number == other.number &&
unionMember1 == other.unionMember1
}
override fun hashCode(): Int = Objects.hash(number, json)
override fun hashCode(): Int = Objects.hash(number, unionMember1)
override fun toString(): String =
when {
number != null -> "Value{number=$number}"
json != null -> "Value{json=$json}"
unionMember1 != null -> "Value{unionMember1=$unionMember1}"
_json != null -> "Value{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Value")
}
@@ -4829,7 +5112,9 @@ private constructor(
@JvmStatic fun ofNumber(number: Double) = Value(number = number)
@JvmStatic fun ofJson(json: JsonValue) = Value(json = json)
@JvmStatic
fun ofUnionMember1(unionMember1: UnionMember1) =
Value(unionMember1 = unionMember1)
}
/**
@@ -4840,7 +5125,7 @@ private constructor(
fun visitNumber(number: Double): T
fun visitJson(json: JsonValue): T
fun visitUnionMember1(unionMember1: UnionMember1): T
/**
* Maps an unknown variant of [Value] to a value of type [T].
@@ -4864,19 +5149,20 @@ private constructor(
val bestMatches =
sequenceOf(
tryDeserialize(node, jacksonTypeRef<UnionMember1>())?.let {
Value(unionMember1 = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<Double>())?.let {
Value(number = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<JsonValue>())?.let {
Value(json = it, _json = json)
},
)
.filterNotNull()
.allMaxBy { it.validity() }
.toList()
return when (bestMatches.size) {
// This can happen if what we're deserializing is completely
// incompatible with all the possible variants.
// incompatible with all the possible variants (e.g. deserializing
// from boolean).
0 -> Value(_json = json)
1 -> bestMatches.single()
// If there's more than one match with the highest validity, then
@@ -4897,12 +5183,126 @@ private constructor(
) {
when {
value.number != null -> generator.writeObject(value.number)
value.json != null -> generator.writeObject(value.json)
value.unionMember1 != null ->
generator.writeObject(value.unionMember1)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Value")
}
}
}
class UnionMember1
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of
* [UnionMember1].
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [UnionMember1]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> =
mutableMapOf()
@JvmSynthetic
internal fun from(unionMember1: UnionMember1) = apply {
additionalProperties =
unionMember1.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(
additionalProperties: Map<String, JsonValue>
) = apply { this.additionalProperties.putAll(additionalProperties) }
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [UnionMember1].
*
* Further updates to this [Builder] will not mutate the returned
* instance.
*/
fun build(): UnionMember1 =
UnionMember1(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): UnionMember1 = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is UnionMember1 &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() =
"UnionMember1{additionalProperties=$additionalProperties}"
}
}
override fun equals(other: Any?): Boolean {
@@ -7054,6 +7454,110 @@ private constructor(
"CommonFilters{filter=$filter, session=$session, traceFilter=$traceFilter, treeFilter=$treeFilter, additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) ->
!value.isNull() && !value.isMissing()
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -14,6 +14,7 @@ import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.Params
import com.langchain.smith.core.http.Headers
import com.langchain.smith.core.http.QueryParams
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -56,7 +57,11 @@ private constructor(
*/
fun endTime(): Optional<OffsetDateTime> = body.endTime()
fun _extra(): JsonValue = body._extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = body.extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -111,6 +116,13 @@ private constructor(
*/
fun _endTime(): JsonField<OffsetDateTime> = body._endTime()
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _extra(): JsonField<Extra> = body._extra()
/**
* Returns the raw JSON value of [name].
*
@@ -260,7 +272,18 @@ private constructor(
*/
fun endTime(endTime: JsonField<OffsetDateTime>) = apply { body.endTime(endTime) }
fun extra(extra: JsonValue) = apply { body.extra(extra) }
fun extra(extra: Extra?) = apply { body.extra(extra) }
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { body.extra(extra) }
fun name(name: String) = apply { body.name(name) }
@@ -469,7 +492,7 @@ private constructor(
private val defaultDatasetId: JsonField<String>,
private val description: JsonField<String>,
private val endTime: JsonField<OffsetDateTime>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val name: JsonField<String>,
private val referenceDatasetId: JsonField<String>,
private val startTime: JsonField<OffsetDateTime>,
@@ -489,7 +512,7 @@ private constructor(
@JsonProperty("end_time")
@ExcludeMissing
endTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
@JsonProperty("reference_dataset_id")
@ExcludeMissing
@@ -538,7 +561,11 @@ private constructor(
*/
fun endTime(): Optional<OffsetDateTime> = endTime.getOptional("end_time")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -600,6 +627,13 @@ private constructor(
@ExcludeMissing
fun _endTime(): JsonField<OffsetDateTime> = endTime
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [name].
*
@@ -660,7 +694,7 @@ private constructor(
private var defaultDatasetId: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var referenceDatasetId: JsonField<String> = JsonMissing.of()
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
@@ -745,7 +779,19 @@ private constructor(
*/
fun endTime(endTime: JsonField<OffsetDateTime>) = apply { this.endTime = endTime }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun name(name: String) = name(JsonField.of(name))
@@ -856,6 +902,7 @@ private constructor(
defaultDatasetId()
description()
endTime()
extra().ifPresent { it.validate() }
name()
referenceDatasetId()
startTime()
@@ -883,6 +930,7 @@ private constructor(
(if (defaultDatasetId.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (endTime.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
(if (startTime.asKnown().isPresent) 1 else 0) +
@@ -927,6 +975,105 @@ private constructor(
"Body{id=$id, defaultDatasetId=$defaultDatasetId, description=$description, endTime=$endTime, extra=$extra, name=$name, referenceDatasetId=$referenceDatasetId, startTime=$startTime, traceTier=$traceTier, additionalProperties=$additionalProperties}"
}
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class TraceTier @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
/**
@@ -14,6 +14,7 @@ import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.Params
import com.langchain.smith.core.http.Headers
import com.langchain.smith.core.http.QueryParams
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -50,7 +51,11 @@ private constructor(
*/
fun endTime(): Optional<OffsetDateTime> = body.endTime()
fun _extra(): JsonValue = body._extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = body.extra()
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -86,6 +91,13 @@ private constructor(
*/
fun _endTime(): JsonField<OffsetDateTime> = body._endTime()
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
fun _extra(): JsonField<Extra> = body._extra()
/**
* Returns the raw JSON value of [name].
*
@@ -200,7 +212,18 @@ private constructor(
*/
fun endTime(endTime: JsonField<OffsetDateTime>) = apply { body.endTime(endTime) }
fun extra(extra: JsonValue) = apply { body.extra(extra) }
fun extra(extra: Extra?) = apply { body.extra(extra) }
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { body.extra(extra) }
fun name(name: String?) = apply { body.name(name) }
@@ -379,7 +402,7 @@ private constructor(
private val defaultDatasetId: JsonField<String>,
private val description: JsonField<String>,
private val endTime: JsonField<OffsetDateTime>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val name: JsonField<String>,
private val traceTier: JsonField<TraceTier>,
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -396,7 +419,7 @@ private constructor(
@JsonProperty("end_time")
@ExcludeMissing
endTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
@JsonProperty("trace_tier")
@ExcludeMissing
@@ -422,7 +445,11 @@ private constructor(
*/
fun endTime(): Optional<OffsetDateTime> = endTime.getOptional("end_time")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -464,6 +491,13 @@ private constructor(
@ExcludeMissing
fun _endTime(): JsonField<OffsetDateTime> = endTime
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [name].
*
@@ -504,7 +538,7 @@ private constructor(
private var defaultDatasetId: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var traceTier: JsonField<TraceTier> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -570,7 +604,19 @@ private constructor(
*/
fun endTime(endTime: JsonField<OffsetDateTime>) = apply { this.endTime = endTime }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun name(name: String?) = name(JsonField.ofNullable(name))
@@ -646,6 +692,7 @@ private constructor(
defaultDatasetId()
description()
endTime()
extra().ifPresent { it.validate() }
name()
traceTier().ifPresent { it.validate() }
validated = true
@@ -670,6 +717,7 @@ private constructor(
(if (defaultDatasetId.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (endTime.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(traceTier.asKnown().getOrNull()?.validity() ?: 0)
@@ -706,6 +754,105 @@ private constructor(
"Body{defaultDatasetId=$defaultDatasetId, description=$description, endTime=$endTime, extra=$extra, name=$name, traceTier=$traceTier, additionalProperties=$additionalProperties}"
}
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class TraceTier @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
/**
@@ -33,8 +33,8 @@ private constructor(
private val description: JsonField<String>,
private val endTime: JsonField<OffsetDateTime>,
private val errorRate: JsonField<Double>,
private val extra: JsonValue,
private val feedbackStats: JsonValue,
private val extra: JsonField<Extra>,
private val feedbackStats: JsonField<FeedbackStats>,
private val firstTokenP50: JsonField<Double>,
private val firstTokenP99: JsonField<Double>,
private val lastRunStartTime: JsonField<OffsetDateTime>,
@@ -46,8 +46,8 @@ private constructor(
private val promptTokens: JsonField<Long>,
private val referenceDatasetId: JsonField<String>,
private val runCount: JsonField<Long>,
private val runFacets: JsonField<List<JsonValue>>,
private val sessionFeedbackStats: JsonValue,
private val runFacets: JsonField<List<RunFacet>>,
private val sessionFeedbackStats: JsonField<SessionFeedbackStats>,
private val startTime: JsonField<OffsetDateTime>,
private val streamingRate: JsonField<Double>,
private val testRunNumber: JsonField<Long>,
@@ -77,8 +77,10 @@ private constructor(
@ExcludeMissing
endTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("error_rate") @ExcludeMissing errorRate: JsonField<Double> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("feedback_stats") @ExcludeMissing feedbackStats: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("feedback_stats")
@ExcludeMissing
feedbackStats: JsonField<FeedbackStats> = JsonMissing.of(),
@JsonProperty("first_token_p50")
@ExcludeMissing
firstTokenP50: JsonField<Double> = JsonMissing.of(),
@@ -110,10 +112,10 @@ private constructor(
@JsonProperty("run_count") @ExcludeMissing runCount: JsonField<Long> = JsonMissing.of(),
@JsonProperty("run_facets")
@ExcludeMissing
runFacets: JsonField<List<JsonValue>> = JsonMissing.of(),
runFacets: JsonField<List<RunFacet>> = JsonMissing.of(),
@JsonProperty("session_feedback_stats")
@ExcludeMissing
sessionFeedbackStats: JsonValue = JsonMissing.of(),
sessionFeedbackStats: JsonField<SessionFeedbackStats> = JsonMissing.of(),
@JsonProperty("start_time")
@ExcludeMissing
startTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -211,9 +213,17 @@ private constructor(
*/
fun errorRate(): Optional<Double> = errorRate.getOptional("error_rate")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
@JsonProperty("feedback_stats") @ExcludeMissing fun _feedbackStats(): JsonValue = feedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun feedbackStats(): Optional<FeedbackStats> = feedbackStats.getOptional("feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -288,11 +298,14 @@ private constructor(
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun runFacets(): Optional<List<JsonValue>> = runFacets.getOptional("run_facets")
fun runFacets(): Optional<List<RunFacet>> = runFacets.getOptional("run_facets")
@JsonProperty("session_feedback_stats")
@ExcludeMissing
fun _sessionFeedbackStats(): JsonValue = sessionFeedbackStats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun sessionFeedbackStats(): Optional<SessionFeedbackStats> =
sessionFeedbackStats.getOptional("session_feedback_stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -394,6 +407,22 @@ private constructor(
*/
@JsonProperty("error_rate") @ExcludeMissing fun _errorRate(): JsonField<Double> = errorRate
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [feedbackStats].
*
* Unlike [feedbackStats], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("feedback_stats")
@ExcludeMissing
fun _feedbackStats(): JsonField<FeedbackStats> = feedbackStats
/**
* Returns the raw JSON value of [firstTokenP50].
*
@@ -493,7 +522,17 @@ private constructor(
*/
@JsonProperty("run_facets")
@ExcludeMissing
fun _runFacets(): JsonField<List<JsonValue>> = runFacets
fun _runFacets(): JsonField<List<RunFacet>> = runFacets
/**
* Returns the raw JSON value of [sessionFeedbackStats].
*
* Unlike [sessionFeedbackStats], this method doesn't throw if the JSON field has an unexpected
* type.
*/
@JsonProperty("session_feedback_stats")
@ExcludeMissing
fun _sessionFeedbackStats(): JsonField<SessionFeedbackStats> = sessionFeedbackStats
/**
* Returns the raw JSON value of [startTime].
@@ -580,8 +619,8 @@ private constructor(
private var description: JsonField<String> = JsonMissing.of()
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var errorRate: JsonField<Double> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var feedbackStats: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var feedbackStats: JsonField<FeedbackStats> = JsonMissing.of()
private var firstTokenP50: JsonField<Double> = JsonMissing.of()
private var firstTokenP99: JsonField<Double> = JsonMissing.of()
private var lastRunStartTime: JsonField<OffsetDateTime> = JsonMissing.of()
@@ -593,8 +632,8 @@ private constructor(
private var promptTokens: JsonField<Long> = JsonMissing.of()
private var referenceDatasetId: JsonField<String> = JsonMissing.of()
private var runCount: JsonField<Long> = JsonMissing.of()
private var runFacets: JsonField<MutableList<JsonValue>>? = null
private var sessionFeedbackStats: JsonValue = JsonMissing.of()
private var runFacets: JsonField<MutableList<RunFacet>>? = null
private var sessionFeedbackStats: JsonField<SessionFeedbackStats> = JsonMissing.of()
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var streamingRate: JsonField<Double> = JsonMissing.of()
private var testRunNumber: JsonField<Long> = JsonMissing.of()
@@ -767,9 +806,36 @@ private constructor(
*/
fun errorRate(errorRate: JsonField<Double>) = apply { this.errorRate = errorRate }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
fun feedbackStats(feedbackStats: JsonValue) = apply { this.feedbackStats = feedbackStats }
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun feedbackStats(feedbackStats: FeedbackStats?) =
feedbackStats(JsonField.ofNullable(feedbackStats))
/** Alias for calling [Builder.feedbackStats] with `feedbackStats.orElse(null)`. */
fun feedbackStats(feedbackStats: Optional<FeedbackStats>) =
feedbackStats(feedbackStats.getOrNull())
/**
* Sets [Builder.feedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.feedbackStats] with a well-typed [FeedbackStats] value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun feedbackStats(feedbackStats: JsonField<FeedbackStats>) = apply {
this.feedbackStats = feedbackStats
}
fun firstTokenP50(firstTokenP50: Double?) =
firstTokenP50(JsonField.ofNullable(firstTokenP50))
@@ -987,35 +1053,52 @@ private constructor(
*/
fun runCount(runCount: JsonField<Long>) = apply { this.runCount = runCount }
fun runFacets(runFacets: List<JsonValue>?) = runFacets(JsonField.ofNullable(runFacets))
fun runFacets(runFacets: List<RunFacet>?) = runFacets(JsonField.ofNullable(runFacets))
/** Alias for calling [Builder.runFacets] with `runFacets.orElse(null)`. */
fun runFacets(runFacets: Optional<List<JsonValue>>) = runFacets(runFacets.getOrNull())
fun runFacets(runFacets: Optional<List<RunFacet>>) = runFacets(runFacets.getOrNull())
/**
* Sets [Builder.runFacets] to an arbitrary JSON value.
*
* You should usually call [Builder.runFacets] with a well-typed `List<JsonValue>` value
* You should usually call [Builder.runFacets] with a well-typed `List<RunFacet>` value
* instead. This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun runFacets(runFacets: JsonField<List<JsonValue>>) = apply {
fun runFacets(runFacets: JsonField<List<RunFacet>>) = apply {
this.runFacets = runFacets.map { it.toMutableList() }
}
/**
* Adds a single [JsonValue] to [runFacets].
* Adds a single [RunFacet] to [runFacets].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
fun addRunFacet(runFacet: JsonValue) = apply {
fun addRunFacet(runFacet: RunFacet) = apply {
runFacets =
(runFacets ?: JsonField.of(mutableListOf())).also {
checkKnown("runFacets", it).add(runFacet)
}
}
fun sessionFeedbackStats(sessionFeedbackStats: JsonValue) = apply {
fun sessionFeedbackStats(sessionFeedbackStats: SessionFeedbackStats?) =
sessionFeedbackStats(JsonField.ofNullable(sessionFeedbackStats))
/**
* Alias for calling [Builder.sessionFeedbackStats] with
* `sessionFeedbackStats.orElse(null)`.
*/
fun sessionFeedbackStats(sessionFeedbackStats: Optional<SessionFeedbackStats>) =
sessionFeedbackStats(sessionFeedbackStats.getOrNull())
/**
* Sets [Builder.sessionFeedbackStats] to an arbitrary JSON value.
*
* You should usually call [Builder.sessionFeedbackStats] with a well-typed
* [SessionFeedbackStats] value instead. This method is primarily for setting the field to
* an undocumented or not yet supported value.
*/
fun sessionFeedbackStats(sessionFeedbackStats: JsonField<SessionFeedbackStats>) = apply {
this.sessionFeedbackStats = sessionFeedbackStats
}
@@ -1209,6 +1292,8 @@ private constructor(
description()
endTime()
errorRate()
extra().ifPresent { it.validate() }
feedbackStats().ifPresent { it.validate() }
firstTokenP50()
firstTokenP99()
lastRunStartTime()
@@ -1220,7 +1305,8 @@ private constructor(
promptTokens()
referenceDatasetId()
runCount()
runFacets()
runFacets().ifPresent { it.forEach { it.validate() } }
sessionFeedbackStats().ifPresent { it.validate() }
startTime()
streamingRate()
testRunNumber()
@@ -1253,6 +1339,8 @@ private constructor(
(if (description.asKnown().isPresent) 1 else 0) +
(if (endTime.asKnown().isPresent) 1 else 0) +
(if (errorRate.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(feedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (firstTokenP50.asKnown().isPresent) 1 else 0) +
(if (firstTokenP99.asKnown().isPresent) 1 else 0) +
(if (lastRunStartTime.asKnown().isPresent) 1 else 0) +
@@ -1264,7 +1352,8 @@ private constructor(
(if (promptTokens.asKnown().isPresent) 1 else 0) +
(if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
(if (runCount.asKnown().isPresent) 1 else 0) +
(runFacets.asKnown().getOrNull()?.size ?: 0) +
(runFacets.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
(sessionFeedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
(if (startTime.asKnown().isPresent) 1 else 0) +
(if (streamingRate.asKnown().isPresent) 1 else 0) +
(if (testRunNumber.asKnown().isPresent) 1 else 0) +
@@ -1272,6 +1361,404 @@ private constructor(
(if (totalTokens.asKnown().isPresent) 1 else 0) +
(traceTier.asKnown().getOrNull()?.validity() ?: 0)
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class FeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [FeedbackStats]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [FeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(feedbackStats: FeedbackStats) = apply {
additionalProperties = feedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [FeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): FeedbackStats = FeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): FeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is FeedbackStats && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "FeedbackStats{additionalProperties=$additionalProperties}"
}
class RunFacet
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [RunFacet]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [RunFacet]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(runFacet: RunFacet) = apply {
additionalProperties = runFacet.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [RunFacet].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): RunFacet = RunFacet(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): RunFacet = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is RunFacet && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "RunFacet{additionalProperties=$additionalProperties}"
}
class SessionFeedbackStats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [SessionFeedbackStats]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [SessionFeedbackStats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(sessionFeedbackStats: SessionFeedbackStats) = apply {
additionalProperties = sessionFeedbackStats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [SessionFeedbackStats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): SessionFeedbackStats =
SessionFeedbackStats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): SessionFeedbackStats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is SessionFeedbackStats &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "SessionFeedbackStats{additionalProperties=$additionalProperties}"
}
class TraceTier @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
/**
@@ -12,6 +12,7 @@ import com.langchain.smith.core.JsonField
import com.langchain.smith.core.JsonMissing
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
import java.time.OffsetDateTime
import java.util.Collections
@@ -28,7 +29,7 @@ private constructor(
private val defaultDatasetId: JsonField<String>,
private val description: JsonField<String>,
private val endTime: JsonField<OffsetDateTime>,
private val extra: JsonValue,
private val extra: JsonField<Extra>,
private val lastRunStartTimeLive: JsonField<OffsetDateTime>,
private val name: JsonField<String>,
private val referenceDatasetId: JsonField<String>,
@@ -50,7 +51,7 @@ private constructor(
@JsonProperty("end_time")
@ExcludeMissing
endTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonValue = JsonMissing.of(),
@JsonProperty("extra") @ExcludeMissing extra: JsonField<Extra> = JsonMissing.of(),
@JsonProperty("last_run_start_time_live")
@ExcludeMissing
lastRunStartTimeLive: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -109,7 +110,11 @@ private constructor(
*/
fun endTime(): Optional<OffsetDateTime> = endTime.getOptional("end_time")
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonValue = extra
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun extra(): Optional<Extra> = extra.getOptional("extra")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -181,6 +186,13 @@ private constructor(
*/
@JsonProperty("end_time") @ExcludeMissing fun _endTime(): JsonField<OffsetDateTime> = endTime
/**
* Returns the raw JSON value of [extra].
*
* Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField<Extra> = extra
/**
* Returns the raw JSON value of [lastRunStartTimeLive].
*
@@ -259,7 +271,7 @@ private constructor(
private var defaultDatasetId: JsonField<String> = JsonMissing.of()
private var description: JsonField<String> = JsonMissing.of()
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var extra: JsonValue = JsonMissing.of()
private var extra: JsonField<Extra> = JsonMissing.of()
private var lastRunStartTimeLive: JsonField<OffsetDateTime> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var referenceDatasetId: JsonField<String> = JsonMissing.of()
@@ -351,7 +363,18 @@ private constructor(
*/
fun endTime(endTime: JsonField<OffsetDateTime>) = apply { this.endTime = endTime }
fun extra(extra: JsonValue) = apply { this.extra = extra }
fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
/** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
fun extra(extra: Optional<Extra>) = extra(extra.getOrNull())
/**
* Sets [Builder.extra] to an arbitrary JSON value.
*
* You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun extra(extra: JsonField<Extra>) = apply { this.extra = extra }
fun lastRunStartTimeLive(lastRunStartTimeLive: OffsetDateTime?) =
lastRunStartTimeLive(JsonField.ofNullable(lastRunStartTimeLive))
@@ -490,6 +513,7 @@ private constructor(
defaultDatasetId()
description()
endTime()
extra().ifPresent { it.validate() }
lastRunStartTimeLive()
name()
referenceDatasetId()
@@ -518,12 +542,112 @@ private constructor(
(if (defaultDatasetId.asKnown().isPresent) 1 else 0) +
(if (description.asKnown().isPresent) 1 else 0) +
(if (endTime.asKnown().isPresent) 1 else 0) +
(extra.asKnown().getOrNull()?.validity() ?: 0) +
(if (lastRunStartTimeLive.asKnown().isPresent) 1 else 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
(if (startTime.asKnown().isPresent) 1 else 0) +
(traceTier.asKnown().getOrNull()?.validity() ?: 0)
class Extra
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Extra]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Extra]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(extra: Extra) = apply {
additionalProperties = extra.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Extra].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Extra = Extra(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Extra = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Extra && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Extra{additionalProperties=$additionalProperties}"
}
class TraceTier @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
/**
@@ -24,7 +24,7 @@ import kotlin.jvm.optionals.getOrNull
class CreateRunClusteringJobRequest
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val attributeSchemas: JsonValue,
private val attributeSchemas: JsonField<AttributeSchemas>,
private val endTime: JsonField<OffsetDateTime>,
private val filter: JsonField<String>,
private val hierarchy: JsonField<List<Long>>,
@@ -44,7 +44,7 @@ private constructor(
private constructor(
@JsonProperty("attribute_schemas")
@ExcludeMissing
attributeSchemas: JsonValue = JsonMissing.of(),
attributeSchemas: JsonField<AttributeSchemas> = JsonMissing.of(),
@JsonProperty("end_time")
@ExcludeMissing
endTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -90,9 +90,12 @@ private constructor(
mutableMapOf(),
)
@JsonProperty("attribute_schemas")
@ExcludeMissing
fun _attributeSchemas(): JsonValue = attributeSchemas
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun attributeSchemas(): Optional<AttributeSchemas> =
attributeSchemas.getOptional("attribute_schemas")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -167,6 +170,16 @@ private constructor(
fun validateModelSecrets(): Optional<Boolean> =
validateModelSecrets.getOptional("validate_model_secrets")
/**
* Returns the raw JSON value of [attributeSchemas].
*
* Unlike [attributeSchemas], this method doesn't throw if the JSON field has an unexpected
* type.
*/
@JsonProperty("attribute_schemas")
@ExcludeMissing
fun _attributeSchemas(): JsonField<AttributeSchemas> = attributeSchemas
/**
* Returns the raw JSON value of [endTime].
*
@@ -286,7 +299,7 @@ private constructor(
/** A builder for [CreateRunClusteringJobRequest]. */
class Builder internal constructor() {
private var attributeSchemas: JsonValue = JsonMissing.of()
private var attributeSchemas: JsonField<AttributeSchemas> = JsonMissing.of()
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var filter: JsonField<String> = JsonMissing.of()
private var hierarchy: JsonField<MutableList<Long>>? = null
@@ -319,7 +332,21 @@ private constructor(
additionalProperties = createRunClusteringJobRequest.additionalProperties.toMutableMap()
}
fun attributeSchemas(attributeSchemas: JsonValue) = apply {
fun attributeSchemas(attributeSchemas: AttributeSchemas?) =
attributeSchemas(JsonField.ofNullable(attributeSchemas))
/** Alias for calling [Builder.attributeSchemas] with `attributeSchemas.orElse(null)`. */
fun attributeSchemas(attributeSchemas: Optional<AttributeSchemas>) =
attributeSchemas(attributeSchemas.getOrNull())
/**
* Sets [Builder.attributeSchemas] to an arbitrary JSON value.
*
* You should usually call [Builder.attributeSchemas] with a well-typed [AttributeSchemas]
* value instead. This method is primarily for setting the field to an undocumented or not
* yet supported value.
*/
fun attributeSchemas(attributeSchemas: JsonField<AttributeSchemas>) = apply {
this.attributeSchemas = attributeSchemas
}
@@ -567,6 +594,7 @@ private constructor(
return@apply
}
attributeSchemas().ifPresent { it.validate() }
endTime()
filter()
hierarchy()
@@ -597,7 +625,8 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(if (endTime.asKnown().isPresent) 1 else 0) +
(attributeSchemas.asKnown().getOrNull()?.validity() ?: 0) +
(if (endTime.asKnown().isPresent) 1 else 0) +
(if (filter.asKnown().isPresent) 1 else 0) +
(hierarchy.asKnown().getOrNull()?.size ?: 0) +
(if (lastNHours.asKnown().isPresent) 1 else 0) +
@@ -610,6 +639,105 @@ private constructor(
(userContext.asKnown().getOrNull()?.validity() ?: 0) +
(if (validateModelSecrets.asKnown().isPresent) 1 else 0)
class AttributeSchemas
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [AttributeSchemas]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [AttributeSchemas]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(attributeSchemas: AttributeSchemas) = apply {
additionalProperties = attributeSchemas.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [AttributeSchemas].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): AttributeSchemas = AttributeSchemas(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): AttributeSchemas = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is AttributeSchemas && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "AttributeSchemas{additionalProperties=$additionalProperties}"
}
class Model @JsonCreator private constructor(private val value: JsonField<String>) : Enum {
/**
@@ -30,7 +30,7 @@ private constructor(
private val status: JsonField<String>,
private val endTime: JsonField<OffsetDateTime>,
private val error: JsonField<String>,
private val metadata: JsonValue,
private val metadata: JsonField<Metadata>,
private val shape: JsonField<Shape>,
private val startTime: JsonField<OffsetDateTime>,
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -48,7 +48,7 @@ private constructor(
@ExcludeMissing
endTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@JsonProperty("error") @ExcludeMissing error: JsonField<String> = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonValue = JsonMissing.of(),
@JsonProperty("metadata") @ExcludeMissing metadata: JsonField<Metadata> = JsonMissing.of(),
@JsonProperty("shape") @ExcludeMissing shape: JsonField<Shape> = JsonMissing.of(),
@JsonProperty("start_time")
@ExcludeMissing
@@ -91,7 +91,11 @@ private constructor(
*/
fun error(): Optional<String> = error.getOptional("error")
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonValue = metadata
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun metadata(): Optional<Metadata> = metadata.getOptional("metadata")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -147,6 +151,13 @@ private constructor(
*/
@JsonProperty("error") @ExcludeMissing fun _error(): JsonField<String> = error
/**
* Returns the raw JSON value of [metadata].
*
* Unlike [metadata], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("metadata") @ExcludeMissing fun _metadata(): JsonField<Metadata> = metadata
/**
* Returns the raw JSON value of [shape].
*
@@ -200,7 +211,7 @@ private constructor(
private var status: JsonField<String>? = null
private var endTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var error: JsonField<String> = JsonMissing.of()
private var metadata: JsonValue = JsonMissing.of()
private var metadata: JsonField<Metadata> = JsonMissing.of()
private var shape: JsonField<Shape> = JsonMissing.of()
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -301,7 +312,19 @@ private constructor(
*/
fun error(error: JsonField<String>) = apply { this.error = error }
fun metadata(metadata: JsonValue) = apply { this.metadata = metadata }
fun metadata(metadata: Metadata?) = metadata(JsonField.ofNullable(metadata))
/** Alias for calling [Builder.metadata] with `metadata.orElse(null)`. */
fun metadata(metadata: Optional<Metadata>) = metadata(metadata.getOrNull())
/**
* Sets [Builder.metadata] to an arbitrary JSON value.
*
* You should usually call [Builder.metadata] with a well-typed [Metadata] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun metadata(metadata: JsonField<Metadata>) = apply { this.metadata = metadata }
fun shape(shape: Shape?) = shape(JsonField.ofNullable(shape))
@@ -392,6 +415,7 @@ private constructor(
status()
endTime()
error()
metadata().ifPresent { it.validate() }
shape().ifPresent { it.validate() }
startTime()
validated = true
@@ -418,6 +442,7 @@ private constructor(
(if (status.asKnown().isPresent) 1 else 0) +
(if (endTime.asKnown().isPresent) 1 else 0) +
(if (error.asKnown().isPresent) 1 else 0) +
(metadata.asKnown().getOrNull()?.validity() ?: 0) +
(shape.asKnown().getOrNull()?.validity() ?: 0) +
(if (startTime.asKnown().isPresent) 1 else 0)
@@ -430,7 +455,7 @@ private constructor(
private val level: JsonField<Long>,
private val name: JsonField<String>,
private val numRuns: JsonField<Long>,
private val stats: JsonValue,
private val stats: JsonField<Stats>,
private val parentId: JsonField<String>,
private val parentName: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -445,7 +470,7 @@ private constructor(
@JsonProperty("level") @ExcludeMissing level: JsonField<Long> = JsonMissing.of(),
@JsonProperty("name") @ExcludeMissing name: JsonField<String> = JsonMissing.of(),
@JsonProperty("num_runs") @ExcludeMissing numRuns: JsonField<Long> = JsonMissing.of(),
@JsonProperty("stats") @ExcludeMissing stats: JsonValue = JsonMissing.of(),
@JsonProperty("stats") @ExcludeMissing stats: JsonField<Stats> = JsonMissing.of(),
@JsonProperty("parent_id")
@ExcludeMissing
parentId: JsonField<String> = JsonMissing.of(),
@@ -484,7 +509,11 @@ private constructor(
*/
fun numRuns(): Long = numRuns.getRequired("num_runs")
@JsonProperty("stats") @ExcludeMissing fun _stats(): JsonValue = stats
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
*/
fun stats(): Optional<Stats> = stats.getOptional("stats")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -535,6 +564,13 @@ private constructor(
*/
@JsonProperty("num_runs") @ExcludeMissing fun _numRuns(): JsonField<Long> = numRuns
/**
* Returns the raw JSON value of [stats].
*
* Unlike [stats], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("stats") @ExcludeMissing fun _stats(): JsonField<Stats> = stats
/**
* Returns the raw JSON value of [parentId].
*
@@ -589,7 +625,7 @@ private constructor(
private var level: JsonField<Long>? = null
private var name: JsonField<String>? = null
private var numRuns: JsonField<Long>? = null
private var stats: JsonValue? = null
private var stats: JsonField<Stats>? = null
private var parentId: JsonField<String> = JsonMissing.of()
private var parentName: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -664,7 +700,19 @@ private constructor(
*/
fun numRuns(numRuns: JsonField<Long>) = apply { this.numRuns = numRuns }
fun stats(stats: JsonValue) = apply { this.stats = stats }
fun stats(stats: Stats?) = stats(JsonField.ofNullable(stats))
/** Alias for calling [Builder.stats] with `stats.orElse(null)`. */
fun stats(stats: Optional<Stats>) = stats(stats.getOrNull())
/**
* Sets [Builder.stats] to an arbitrary JSON value.
*
* You should usually call [Builder.stats] with a well-typed [Stats] value instead. This
* method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun stats(stats: JsonField<Stats>) = apply { this.stats = stats }
fun parentId(parentId: String?) = parentId(JsonField.ofNullable(parentId))
@@ -756,6 +804,7 @@ private constructor(
level()
name()
numRuns()
stats().ifPresent { it.validate() }
parentId()
parentName()
validated = true
@@ -782,9 +831,112 @@ private constructor(
(if (level.asKnown().isPresent) 1 else 0) +
(if (name.asKnown().isPresent) 1 else 0) +
(if (numRuns.asKnown().isPresent) 1 else 0) +
(stats.asKnown().getOrNull()?.validity() ?: 0) +
(if (parentId.asKnown().isPresent) 1 else 0) +
(if (parentName.asKnown().isPresent) 1 else 0)
class Stats
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Stats]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Stats]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(stats: Stats) = apply {
additionalProperties = stats.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply {
additionalProperties.remove(key)
}
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Stats].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Stats = Stats(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Stats = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Stats && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Stats{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -822,6 +974,105 @@ private constructor(
"Cluster{id=$id, description=$description, level=$level, name=$name, numRuns=$numRuns, stats=$stats, parentId=$parentId, parentName=$parentName, additionalProperties=$additionalProperties}"
}
class Metadata
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Metadata]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Metadata]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(metadata: Metadata) = apply {
additionalProperties = metadata.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Metadata = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Metadata && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Metadata{additionalProperties=$additionalProperties}"
}
class Shape
@JsonCreator
private constructor(
@@ -23,14 +23,14 @@ class InsightRetrieveRunsResponse
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val offset: JsonField<Long>,
private val runs: JsonField<List<JsonValue>>,
private val runs: JsonField<List<Run>>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@JsonCreator
private constructor(
@JsonProperty("offset") @ExcludeMissing offset: JsonField<Long> = JsonMissing.of(),
@JsonProperty("runs") @ExcludeMissing runs: JsonField<List<JsonValue>> = JsonMissing.of(),
@JsonProperty("runs") @ExcludeMissing runs: JsonField<List<Run>> = JsonMissing.of(),
) : this(offset, runs, mutableMapOf())
/**
@@ -43,7 +43,7 @@ private constructor(
* @throws LangChainInvalidDataException 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 runs(): List<JsonValue> = runs.getRequired("runs")
fun runs(): List<Run> = runs.getRequired("runs")
/**
* Returns the raw JSON value of [offset].
@@ -57,7 +57,7 @@ private constructor(
*
* Unlike [runs], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("runs") @ExcludeMissing fun _runs(): JsonField<List<JsonValue>> = runs
@JsonProperty("runs") @ExcludeMissing fun _runs(): JsonField<List<Run>> = runs
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
@@ -89,7 +89,7 @@ private constructor(
class Builder internal constructor() {
private var offset: JsonField<Long>? = null
private var runs: JsonField<MutableList<JsonValue>>? = null
private var runs: JsonField<MutableList<Run>>? = null
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
@@ -119,25 +119,22 @@ private constructor(
*/
fun offset(offset: JsonField<Long>) = apply { this.offset = offset }
fun runs(runs: List<JsonValue>) = runs(JsonField.of(runs))
fun runs(runs: List<Run>) = runs(JsonField.of(runs))
/**
* Sets [Builder.runs] to an arbitrary JSON value.
*
* You should usually call [Builder.runs] with a well-typed `List<JsonValue>` value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
* You should usually call [Builder.runs] with a well-typed `List<Run>` value instead. This
* method is primarily for setting the field to an undocumented or not yet supported value.
*/
fun runs(runs: JsonField<List<JsonValue>>) = apply {
this.runs = runs.map { it.toMutableList() }
}
fun runs(runs: JsonField<List<Run>>) = apply { this.runs = runs.map { it.toMutableList() } }
/**
* Adds a single [JsonValue] to [runs].
* Adds a single [Run] to [runs].
*
* @throws IllegalStateException if the field was previously set to a non-list.
*/
fun addRun(run: JsonValue) = apply {
fun addRun(run: Run) = apply {
runs = (runs ?: JsonField.of(mutableListOf())).also { checkKnown("runs", it).add(run) }
}
@@ -189,7 +186,7 @@ private constructor(
}
offset()
runs()
runs().forEach { it.validate() }
validated = true
}
@@ -208,7 +205,107 @@ private constructor(
*/
@JvmSynthetic
internal fun validity(): Int =
(if (offset.asKnown().isPresent) 1 else 0) + (runs.asKnown().getOrNull()?.size ?: 0)
(if (offset.asKnown().isPresent) 1 else 0) +
(runs.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
class Run
@JsonCreator
private constructor(
@com.fasterxml.jackson.annotation.JsonValue
private val additionalProperties: Map<String, JsonValue>
) {
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
fun toBuilder() = Builder().from(this)
companion object {
/** Returns a mutable builder for constructing an instance of [Run]. */
@JvmStatic fun builder() = Builder()
}
/** A builder for [Run]. */
class Builder internal constructor() {
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(run: Run) = apply {
additionalProperties = run.additionalProperties.toMutableMap()
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
}
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
additionalProperties.put(key, value)
}
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) }
fun removeAllAdditionalProperties(keys: Set<String>) = apply {
keys.forEach(::removeAdditionalProperty)
}
/**
* Returns an immutable instance of [Run].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Run = Run(additionalProperties.toImmutable())
}
private var validated: Boolean = false
fun validate(): Run = apply {
if (validated) {
return@apply
}
validated = true
}
fun isValid(): Boolean =
try {
validate()
true
} catch (e: LangChainInvalidDataException) {
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 =
additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Run && additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
override fun hashCode(): Int = hashCode
override fun toString() = "Run{additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -19,7 +19,11 @@ internal class AnnotationQueueAnnotationQueuesParamsTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueAnnotationQueuesParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.rubricInstructions("rubric_instructions")
@@ -54,7 +58,11 @@ internal class AnnotationQueueAnnotationQueuesParamsTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueAnnotationQueuesParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.rubricInstructions("rubric_instructions")
@@ -86,7 +94,12 @@ internal class AnnotationQueueAnnotationQueuesParamsTest {
assertThat(body.defaultDataset()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.description()).contains("description")
assertThat(body.enableReservations()).contains(true)
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.metadata())
.contains(
AnnotationQueueAnnotationQueuesParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.numReviewersPerItem()).contains(0L)
assertThat(body.reservationMinutes()).contains(0L)
assertThat(body.rubricInstructions()).contains("rubric_instructions")
@@ -24,7 +24,11 @@ internal class AnnotationQueueRetrieveAnnotationQueuesResponseTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueRetrieveAnnotationQueuesResponse.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.runRuleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -48,8 +52,12 @@ internal class AnnotationQueueRetrieveAnnotationQueuesResponseTest {
.contains("description")
assertThat(annotationQueueRetrieveAnnotationQueuesResponse.enableReservations())
.contains(true)
assertThat(annotationQueueRetrieveAnnotationQueuesResponse._metadata())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(annotationQueueRetrieveAnnotationQueuesResponse.metadata())
.contains(
AnnotationQueueRetrieveAnnotationQueuesResponse.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(annotationQueueRetrieveAnnotationQueuesResponse.numReviewersPerItem())
.contains(0L)
assertThat(annotationQueueRetrieveAnnotationQueuesResponse.reservationMinutes())
@@ -76,7 +84,11 @@ internal class AnnotationQueueRetrieveAnnotationQueuesResponseTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueRetrieveAnnotationQueuesResponse.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.runRuleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -24,7 +24,11 @@ internal class AnnotationQueueRetrieveResponseTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueRetrieveResponse.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.rubricInstructions("rubric_instructions")
@@ -62,8 +66,12 @@ internal class AnnotationQueueRetrieveResponseTest {
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(annotationQueueRetrieveResponse.description()).contains("description")
assertThat(annotationQueueRetrieveResponse.enableReservations()).contains(true)
assertThat(annotationQueueRetrieveResponse._metadata())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(annotationQueueRetrieveResponse.metadata())
.contains(
AnnotationQueueRetrieveResponse.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(annotationQueueRetrieveResponse.numReviewersPerItem()).contains(0L)
assertThat(annotationQueueRetrieveResponse.reservationMinutes()).contains(0L)
assertThat(annotationQueueRetrieveResponse.rubricInstructions())
@@ -106,7 +114,11 @@ internal class AnnotationQueueRetrieveResponseTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueRetrieveResponse.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.rubricInstructions("rubric_instructions")
@@ -23,7 +23,11 @@ internal class AnnotationQueueSchemaTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueSchema.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.runRuleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -43,8 +47,12 @@ internal class AnnotationQueueSchemaTest {
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(annotationQueueSchema.description()).contains("description")
assertThat(annotationQueueSchema.enableReservations()).contains(true)
assertThat(annotationQueueSchema._metadata())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(annotationQueueSchema.metadata())
.contains(
AnnotationQueueSchema.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(annotationQueueSchema.numReviewersPerItem()).contains(0L)
assertThat(annotationQueueSchema.reservationMinutes()).contains(0L)
assertThat(annotationQueueSchema.runRuleId())
@@ -68,7 +76,11 @@ internal class AnnotationQueueSchemaTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueSchema.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numReviewersPerItem(0L)
.reservationMinutes(0L)
.runRuleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -16,7 +16,11 @@ internal class AnnotationQueueUpdateParamsTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueUpdateParams.Metadata.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.numReviewersPerItem(0L)
.reservationMinutes(0L)
@@ -60,7 +64,11 @@ internal class AnnotationQueueUpdateParamsTest {
.defaultDataset("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.enableReservations(true)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AnnotationQueueUpdateParams.Metadata.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.numReviewersPerItem(0L)
.reservationMinutes(0L)
@@ -90,8 +98,10 @@ internal class AnnotationQueueUpdateParamsTest {
assertThat(body.enableReservations()).contains(true)
assertThat(body.metadata())
.contains(
AnnotationQueueUpdateParams.Metadata.ofJsonValue(
JsonValue.from(mapOf<String, Any>())
AnnotationQueueUpdateParams.Metadata.ofUnionMember0(
AnnotationQueueUpdateParams.Metadata.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(body.name()).contains("name")
@@ -43,26 +43,50 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.effectiveAddedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
RunSchemaWithAnnotationQueueInfo.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
RunSchemaWithAnnotationQueueInfo.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
RunSchemaWithAnnotationQueueInfo.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
RunSchemaWithAnnotationQueueInfo.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
RunSchemaWithAnnotationQueueInfo.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
RunSchemaWithAnnotationQueueInfo.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
RunSchemaWithAnnotationQueueInfo.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -80,8 +104,16 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
RunSchemaWithAnnotationQueueInfo.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
RunSchemaWithAnnotationQueueInfo.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -136,24 +168,40 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(runSchemaWithAnnotationQueueInfo.error()).contains("error")
assertThat(runSchemaWithAnnotationQueueInfo.events().getOrNull())
.containsExactly(JsonValue.from(mapOf<String, Any>()))
.containsExactly(
RunSchemaWithAnnotationQueueInfo.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.executionOrder()).contains(1L)
assertThat(runSchemaWithAnnotationQueueInfo._extra())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo.extra())
.contains(
RunSchemaWithAnnotationQueueInfo.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.feedbackStats())
.contains(
RunSchemaWithAnnotationQueueInfo.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.firstTokenTime())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(runSchemaWithAnnotationQueueInfo.inDataset()).contains(true)
assertThat(runSchemaWithAnnotationQueueInfo._inputs())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo.inputs())
.contains(
RunSchemaWithAnnotationQueueInfo.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.inputsPreview()).contains("inputs_preview")
assertThat(runSchemaWithAnnotationQueueInfo._inputsS3Urls())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo.inputsS3Urls())
.contains(
RunSchemaWithAnnotationQueueInfo.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.lastQueuedAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(runSchemaWithAnnotationQueueInfo.lastReviewedTime())
@@ -162,11 +210,19 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo.manifestS3Id())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo._outputs())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo.outputs())
.contains(
RunSchemaWithAnnotationQueueInfo.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.outputsPreview()).contains("outputs_preview")
assertThat(runSchemaWithAnnotationQueueInfo._outputsS3Urls())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo.outputsS3Urls())
.contains(
RunSchemaWithAnnotationQueueInfo.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.parentRunId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo.parentRunIds().getOrNull())
@@ -191,10 +247,18 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo.referenceExampleId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo._s3Urls())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo._serialized())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runSchemaWithAnnotationQueueInfo.s3Urls())
.contains(
RunSchemaWithAnnotationQueueInfo.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.serialized())
.contains(
RunSchemaWithAnnotationQueueInfo.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runSchemaWithAnnotationQueueInfo.shareToken())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo.startTime())
@@ -247,26 +311,50 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.effectiveAddedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
RunSchemaWithAnnotationQueueInfo.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
RunSchemaWithAnnotationQueueInfo.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
RunSchemaWithAnnotationQueueInfo.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
RunSchemaWithAnnotationQueueInfo.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
RunSchemaWithAnnotationQueueInfo.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
RunSchemaWithAnnotationQueueInfo.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
RunSchemaWithAnnotationQueueInfo.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -284,8 +372,16 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
RunSchemaWithAnnotationQueueInfo.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
RunSchemaWithAnnotationQueueInfo.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -21,7 +21,11 @@ internal class CommitListPageResponseTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -41,7 +45,11 @@ internal class CommitListPageResponseTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -65,7 +73,11 @@ internal class CommitListPageResponseTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -17,28 +17,52 @@ internal class CommitManifestResponseTest {
val commitManifestResponse =
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
.build()
assertThat(commitManifestResponse.commitHash()).isEqualTo("commit_hash")
assertThat(commitManifestResponse._manifest())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(commitManifestResponse.manifest())
.isEqualTo(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(commitManifestResponse.examples().getOrNull())
.containsExactly(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -50,13 +74,25 @@ internal class CommitManifestResponseTest {
val commitManifestResponse =
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -14,7 +14,11 @@ internal class CommitUpdateParamsTest {
CommitUpdateParams.builder()
.owner("owner")
.repo("repo")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitUpdateParams.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.parentCommit("parent_commit")
.skipWebhooks(true)
@@ -27,7 +31,11 @@ internal class CommitUpdateParamsTest {
CommitUpdateParams.builder()
.owner("owner")
.repo("repo")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitUpdateParams.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.build()
assertThat(params._pathParam(0)).isEqualTo("owner")
@@ -42,7 +50,11 @@ internal class CommitUpdateParamsTest {
CommitUpdateParams.builder()
.owner("owner")
.repo("repo")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitUpdateParams.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.parentCommit("parent_commit")
.skipWebhooks(true)
@@ -50,7 +62,12 @@ internal class CommitUpdateParamsTest {
val body = params._body()
assertThat(body._manifest()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.manifest())
.isEqualTo(
CommitUpdateParams.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.exampleRunIds().getOrNull())
.containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.parentCommit()).contains("parent_commit")
@@ -63,11 +80,20 @@ internal class CommitUpdateParamsTest {
CommitUpdateParams.builder()
.owner("owner")
.repo("repo")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitUpdateParams.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.build()
val body = params._body()
assertThat(body._manifest()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.manifest())
.isEqualTo(
CommitUpdateParams.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
}
}
@@ -21,7 +21,11 @@ internal class CommitUpdateResponseTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -40,7 +44,11 @@ internal class CommitUpdateResponseTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -63,7 +71,11 @@ internal class CommitUpdateResponseTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -19,7 +19,11 @@ internal class CommitWithLookupsTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -35,7 +39,12 @@ internal class CommitWithLookupsTest {
.isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(commitWithLookups.exampleRunIds())
.containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(commitWithLookups._manifest()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(commitWithLookups.manifest())
.isEqualTo(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(commitWithLookups.numDownloads()).isEqualTo(0L)
assertThat(commitWithLookups.numViews()).isEqualTo(0L)
assertThat(commitWithLookups.repoId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -55,7 +64,11 @@ internal class CommitWithLookupsTest {
.commitHash("commit_hash")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addExampleRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitWithLookups.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.numDownloads(0L)
.numViews(0L)
.repoId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -3,6 +3,7 @@
package com.langchain.smith.models.datasets
import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.jsonMapper
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test
@@ -11,13 +12,19 @@ internal class DatasetCloneResponseTest {
@Test
fun create() {
val datasetCloneResponse = DatasetCloneResponse.builder().build()
val datasetCloneResponse =
DatasetCloneResponse.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
}
@Test
fun roundtrip() {
val jsonMapper = jsonMapper()
val datasetCloneResponse = DatasetCloneResponse.builder().build()
val datasetCloneResponse =
DatasetCloneResponse.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
val roundtrippedDatasetCloneResponse =
jsonMapper.readValue(
@@ -19,9 +19,21 @@ internal class DatasetCreateParamsTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.extra(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.extra(
DatasetCreateParams.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsSchemaDefinition(
DatasetCreateParams.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
DatasetCreateParams.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -43,9 +55,21 @@ internal class DatasetCreateParamsTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.extra(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.extra(
DatasetCreateParams.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsSchemaDefinition(
DatasetCreateParams.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
DatasetCreateParams.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -64,9 +88,24 @@ internal class DatasetCreateParamsTest {
assertThat(body.dataType()).contains(DataType.KV)
assertThat(body.description()).contains("description")
assertThat(body.externallyManaged()).contains(true)
assertThat(body._extra()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body._inputsSchemaDefinition()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body._outputsSchemaDefinition()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.extra())
.contains(
DatasetCreateParams.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.inputsSchemaDefinition())
.contains(
DatasetCreateParams.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.outputsSchemaDefinition())
.contains(
DatasetCreateParams.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.transformations().getOrNull())
.containsExactly(
DatasetTransformation.builder()
@@ -26,10 +26,22 @@ internal class DatasetTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
Dataset.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastSessionStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.metadata(
Dataset.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
Dataset.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -50,13 +62,26 @@ internal class DatasetTest {
assertThat(dataset.dataType()).contains(DataType.KV)
assertThat(dataset.description()).contains("description")
assertThat(dataset.externallyManaged()).contains(true)
assertThat(dataset._inputsSchemaDefinition())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(dataset.inputsSchemaDefinition())
.contains(
Dataset.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(dataset.lastSessionStartTime())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(dataset._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(dataset._outputsSchemaDefinition())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(dataset.metadata())
.contains(
Dataset.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(dataset.outputsSchemaDefinition())
.contains(
Dataset.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(dataset.transformations().getOrNull())
.containsExactly(
DatasetTransformation.builder()
@@ -83,10 +108,22 @@ internal class DatasetTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
Dataset.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastSessionStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.metadata(
Dataset.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
Dataset.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -13,10 +13,22 @@ internal class DatasetUpdateParamsTest {
DatasetUpdateParams.builder()
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("string")
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
DatasetUpdateParams.InputsSchemaDefinition.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
DatasetUpdateParams.Metadata.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("string")
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(
DatasetUpdateParams.OutputsSchemaDefinition.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.patchExamples(
DatasetUpdateParams.PatchExamples.builder()
.putAdditionalProperty(
@@ -29,9 +41,9 @@ internal class DatasetUpdateParamsTest {
"retain" to listOf("string"),
),
"dataset_id" to "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"inputs" to mapOf<String, Any>(),
"metadata" to mapOf<String, Any>(),
"outputs" to mapOf<String, Any>(),
"inputs" to mapOf("foo" to "bar"),
"metadata" to mapOf("foo" to "bar"),
"outputs" to mapOf("foo" to "bar"),
"overwrite" to true,
"split" to listOf("string"),
)
@@ -68,10 +80,22 @@ internal class DatasetUpdateParamsTest {
DatasetUpdateParams.builder()
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("string")
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
DatasetUpdateParams.InputsSchemaDefinition.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
DatasetUpdateParams.Metadata.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("string")
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(
DatasetUpdateParams.OutputsSchemaDefinition.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.patchExamples(
DatasetUpdateParams.PatchExamples.builder()
.putAdditionalProperty(
@@ -84,9 +108,9 @@ internal class DatasetUpdateParamsTest {
"retain" to listOf("string"),
),
"dataset_id" to "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"inputs" to mapOf<String, Any>(),
"metadata" to mapOf<String, Any>(),
"outputs" to mapOf<String, Any>(),
"inputs" to mapOf("foo" to "bar"),
"metadata" to mapOf("foo" to "bar"),
"outputs" to mapOf("foo" to "bar"),
"overwrite" to true,
"split" to listOf("string"),
)
@@ -111,19 +135,27 @@ internal class DatasetUpdateParamsTest {
assertThat(body.description()).contains(DatasetUpdateParams.Description.ofString("string"))
assertThat(body.inputsSchemaDefinition())
.contains(
DatasetUpdateParams.InputsSchemaDefinition.ofJsonValue(
JsonValue.from(mapOf<String, Any>())
DatasetUpdateParams.InputsSchemaDefinition.ofUnionMember0(
DatasetUpdateParams.InputsSchemaDefinition.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(body.metadata())
.contains(
DatasetUpdateParams.Metadata.ofJsonValue(JsonValue.from(mapOf<String, Any>()))
DatasetUpdateParams.Metadata.ofUnionMember0(
DatasetUpdateParams.Metadata.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(body.name()).contains(DatasetUpdateParams.Name.ofString("string"))
assertThat(body.outputsSchemaDefinition())
.contains(
DatasetUpdateParams.OutputsSchemaDefinition.ofJsonValue(
JsonValue.from(mapOf<String, Any>())
DatasetUpdateParams.OutputsSchemaDefinition.ofUnionMember0(
DatasetUpdateParams.OutputsSchemaDefinition.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(body.patchExamples())
@@ -139,9 +171,9 @@ internal class DatasetUpdateParamsTest {
"retain" to listOf("string"),
),
"dataset_id" to "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"inputs" to mapOf<String, Any>(),
"metadata" to mapOf<String, Any>(),
"outputs" to mapOf<String, Any>(),
"inputs" to mapOf("foo" to "bar"),
"metadata" to mapOf("foo" to "bar"),
"outputs" to mapOf("foo" to "bar"),
"overwrite" to true,
"split" to listOf("string"),
)
@@ -23,8 +23,16 @@ internal class DatasetUpdateResponseTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
DatasetUpdateResponse.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
DatasetUpdateResponse.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -44,10 +52,18 @@ internal class DatasetUpdateResponseTest {
assertThat(datasetUpdateResponse.dataType()).contains(DataType.KV)
assertThat(datasetUpdateResponse.description()).contains("description")
assertThat(datasetUpdateResponse.externallyManaged()).contains(true)
assertThat(datasetUpdateResponse._inputsSchemaDefinition())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(datasetUpdateResponse._outputsSchemaDefinition())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(datasetUpdateResponse.inputsSchemaDefinition())
.contains(
DatasetUpdateResponse.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(datasetUpdateResponse.outputsSchemaDefinition())
.contains(
DatasetUpdateResponse.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(datasetUpdateResponse.transformations().getOrNull())
.containsExactly(
DatasetTransformation.builder()
@@ -71,8 +87,16 @@ internal class DatasetUpdateResponseTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
DatasetUpdateResponse.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
DatasetUpdateResponse.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -20,9 +20,17 @@ internal class FeedbackCreateCoreSchemaTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateCoreSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
FeedbackCreateCoreSchema.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackConfig(
FeedbackCreateCoreSchema.FeedbackConfig.builder()
.type(FeedbackCreateCoreSchema.FeedbackConfig.Type.CONTINUOUS)
@@ -39,7 +47,11 @@ internal class FeedbackCreateCoreSchemaTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -55,14 +67,20 @@ internal class FeedbackCreateCoreSchemaTest {
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(feedbackCreateCoreSchema.correction())
.contains(
FeedbackCreateCoreSchema.Correction.ofJsonValue(
JsonValue.from(mapOf<String, Any>())
FeedbackCreateCoreSchema.Correction.ofUnionMember0(
FeedbackCreateCoreSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(feedbackCreateCoreSchema.createdAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(feedbackCreateCoreSchema._extra())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(feedbackCreateCoreSchema.extra())
.contains(
FeedbackCreateCoreSchema.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(feedbackCreateCoreSchema.feedbackConfig())
.contains(
FeedbackCreateCoreSchema.FeedbackConfig.builder()
@@ -83,7 +101,11 @@ internal class FeedbackCreateCoreSchemaTest {
.contains(
FeedbackCreateCoreSchema.FeedbackSource.ofApp(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -105,9 +127,17 @@ internal class FeedbackCreateCoreSchemaTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateCoreSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
FeedbackCreateCoreSchema.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackConfig(
FeedbackCreateCoreSchema.FeedbackConfig.builder()
.type(FeedbackCreateCoreSchema.FeedbackConfig.Type.CONTINUOUS)
@@ -124,7 +154,11 @@ internal class FeedbackCreateCoreSchemaTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -16,7 +16,11 @@ internal class ComparativeCreateParamsTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ComparativeCreateParams.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.name("name")
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -31,7 +35,11 @@ internal class ComparativeCreateParamsTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ComparativeCreateParams.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.name("name")
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -43,7 +51,12 @@ internal class ComparativeCreateParamsTest {
assertThat(body.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.createdAt()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(body.description()).contains("description")
assertThat(body._extra()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.extra())
.contains(
ComparativeCreateParams.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.modifiedAt()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(body.name()).contains("name")
assertThat(body.referenceDatasetId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -21,7 +21,11 @@ internal class ComparativeCreateResponseTest {
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tenantId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ComparativeCreateResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.build()
@@ -35,8 +39,12 @@ internal class ComparativeCreateResponseTest {
assertThat(comparativeCreateResponse.tenantId())
.isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(comparativeCreateResponse.description()).contains("description")
assertThat(comparativeCreateResponse._extra())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(comparativeCreateResponse.extra())
.contains(
ComparativeCreateResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(comparativeCreateResponse.name()).contains("name")
}
@@ -51,7 +59,11 @@ internal class ComparativeCreateResponseTest {
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tenantId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ComparativeCreateResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.build()
@@ -27,8 +27,16 @@ internal class ComparativeListResponseTest {
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tenantId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
ComparativeListResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ComparativeListResponse.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.build()
@@ -49,9 +57,18 @@ internal class ComparativeListResponseTest {
assertThat(comparativeListResponse.tenantId())
.isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(comparativeListResponse.description()).contains("description")
assertThat(comparativeListResponse._extra()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(comparativeListResponse._feedbackStats())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(comparativeListResponse.extra())
.contains(
ComparativeListResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(comparativeListResponse.feedbackStats())
.contains(
ComparativeListResponse.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(comparativeListResponse.name()).contains("name")
}
@@ -72,8 +89,16 @@ internal class ComparativeListResponseTest {
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.tenantId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
ComparativeListResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ComparativeListResponse.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.build()
@@ -23,7 +23,11 @@ internal class GroupRunsResponseTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -39,31 +43,63 @@ internal class GroupRunsResponseTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -76,11 +112,23 @@ internal class GroupRunsResponseTest {
)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -98,8 +146,16 @@ internal class GroupRunsResponseTest {
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.errorRate(0.0)
.exampleCount(0L)
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
GroupRunsResponse.Group.Session.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
GroupRunsResponse.Group.Session.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.firstTokenP50(0.0)
.firstTokenP99(0.0)
.lastRunStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -115,8 +171,16 @@ internal class GroupRunsResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runCount(0L)
.addRunFacet(JsonValue.from(mapOf<String, Any>()))
.sessionFeedbackStats(JsonValue.from(mapOf<String, Any>()))
.addRunFacet(
GroupRunsResponse.Group.Session.RunFacet.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sessionFeedbackStats(
GroupRunsResponse.Group.Session.SessionFeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.streamingRate(0.0)
.testRunNumber(0L)
@@ -129,7 +193,11 @@ internal class GroupRunsResponseTest {
.completionTokens(0L)
.count(0L)
.errorRate(0.0)
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(
GroupRunsResponse.Group.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.latencyP50(0.0)
.latencyP99(0.0)
.maxStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -150,7 +218,11 @@ internal class GroupRunsResponseTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -166,31 +238,63 @@ internal class GroupRunsResponseTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -203,11 +307,23 @@ internal class GroupRunsResponseTest {
)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -225,8 +341,16 @@ internal class GroupRunsResponseTest {
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.errorRate(0.0)
.exampleCount(0L)
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
GroupRunsResponse.Group.Session.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
GroupRunsResponse.Group.Session.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.firstTokenP50(0.0)
.firstTokenP99(0.0)
.lastRunStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -240,8 +364,16 @@ internal class GroupRunsResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runCount(0L)
.addRunFacet(JsonValue.from(mapOf<String, Any>()))
.sessionFeedbackStats(JsonValue.from(mapOf<String, Any>()))
.addRunFacet(
GroupRunsResponse.Group.Session.RunFacet.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sessionFeedbackStats(
GroupRunsResponse.Group.Session.SessionFeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.streamingRate(0.0)
.testRunNumber(0L)
@@ -254,7 +386,11 @@ internal class GroupRunsResponseTest {
.completionTokens(0L)
.count(0L)
.errorRate(0.0)
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(
GroupRunsResponse.Group.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.latencyP50(0.0)
.latencyP99(0.0)
.maxStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -279,7 +415,11 @@ internal class GroupRunsResponseTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -295,31 +435,63 @@ internal class GroupRunsResponseTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -332,11 +504,23 @@ internal class GroupRunsResponseTest {
)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -354,8 +538,16 @@ internal class GroupRunsResponseTest {
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.errorRate(0.0)
.exampleCount(0L)
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
GroupRunsResponse.Group.Session.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
GroupRunsResponse.Group.Session.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.firstTokenP50(0.0)
.firstTokenP99(0.0)
.lastRunStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -371,8 +563,16 @@ internal class GroupRunsResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runCount(0L)
.addRunFacet(JsonValue.from(mapOf<String, Any>()))
.sessionFeedbackStats(JsonValue.from(mapOf<String, Any>()))
.addRunFacet(
GroupRunsResponse.Group.Session.RunFacet.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sessionFeedbackStats(
GroupRunsResponse.Group.Session.SessionFeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.streamingRate(0.0)
.testRunNumber(0L)
@@ -385,7 +585,11 @@ internal class GroupRunsResponseTest {
.completionTokens(0L)
.count(0L)
.errorRate(0.0)
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(
GroupRunsResponse.Group.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.latencyP50(0.0)
.latencyP99(0.0)
.maxStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -17,9 +17,17 @@ internal class PlaygroundExperimentBatchParamsTest {
.options(
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -36,7 +44,11 @@ internal class PlaygroundExperimentBatchParamsTest {
.commit("commit")
.addDatasetSplit("string")
.addEvaluatorRule("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
PlaygroundExperimentBatchParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.owner("owner")
.parallelToolCalls(true)
.repetitions(1L)
@@ -60,9 +72,17 @@ internal class PlaygroundExperimentBatchParamsTest {
.options(
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -79,7 +99,11 @@ internal class PlaygroundExperimentBatchParamsTest {
.commit("commit")
.addDatasetSplit("string")
.addEvaluatorRule("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
PlaygroundExperimentBatchParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.owner("owner")
.parallelToolCalls(true)
.repetitions(1L)
@@ -101,9 +125,17 @@ internal class PlaygroundExperimentBatchParamsTest {
.isEqualTo(
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -122,7 +154,12 @@ internal class PlaygroundExperimentBatchParamsTest {
assertThat(body.datasetSplits().getOrNull()).containsExactly("string")
assertThat(body.evaluatorRules().getOrNull())
.containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.metadata())
.contains(
PlaygroundExperimentBatchParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.owner()).contains("owner")
assertThat(body.parallelToolCalls()).contains(true)
assertThat(body.repetitions()).contains(1L)
@@ -17,9 +17,17 @@ internal class PlaygroundExperimentStreamParamsTest {
.options(
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -35,7 +43,11 @@ internal class PlaygroundExperimentStreamParamsTest {
.commit("commit")
.addDatasetSplit("string")
.addEvaluatorRule("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
PlaygroundExperimentStreamParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.owner("owner")
.parallelToolCalls(true)
.repetitions(1L)
@@ -59,9 +71,17 @@ internal class PlaygroundExperimentStreamParamsTest {
.options(
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -77,7 +97,11 @@ internal class PlaygroundExperimentStreamParamsTest {
.commit("commit")
.addDatasetSplit("string")
.addEvaluatorRule("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
PlaygroundExperimentStreamParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.owner("owner")
.parallelToolCalls(true)
.repetitions(1L)
@@ -99,9 +123,17 @@ internal class PlaygroundExperimentStreamParamsTest {
.isEqualTo(
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -119,7 +151,12 @@ internal class PlaygroundExperimentStreamParamsTest {
assertThat(body.datasetSplits().getOrNull()).containsExactly("string")
assertThat(body.evaluatorRules().getOrNull())
.containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.metadata())
.contains(
PlaygroundExperimentStreamParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.owner()).contains("owner")
assertThat(body.parallelToolCalls()).contains(true)
assertThat(body.repetitions()).contains(1L)
@@ -16,9 +16,17 @@ internal class RunnableConfigTest {
val runnableConfig =
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -29,9 +37,19 @@ internal class RunnableConfigTest {
.contains(
RunnableConfig.Callbacks.ofJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
)
assertThat(runnableConfig._configurable()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runnableConfig.configurable())
.contains(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runnableConfig.maxConcurrency()).contains(0L)
assertThat(runnableConfig._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(runnableConfig.metadata())
.contains(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(runnableConfig.recursionLimit()).contains(0L)
assertThat(runnableConfig.runId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runnableConfig.runName()).contains("run_name")
@@ -44,9 +62,17 @@ internal class RunnableConfigTest {
val runnableConfig =
RunnableConfig.builder()
.callbacksOfJsonValues(listOf(JsonValue.from(mapOf<String, Any>())))
.configurable(JsonValue.from(mapOf<String, Any>()))
.configurable(
RunnableConfig.Configurable.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.maxConcurrency(0L)
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
RunnableConfig.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.recursionLimit(0L)
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.runName("run_name")
@@ -17,7 +17,11 @@ internal class ExampleWithRunsChTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -33,28 +37,60 @@ internal class ExampleWithRunsChTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -63,17 +99,34 @@ internal class ExampleWithRunsChTest {
.traceMinStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
assertThat(exampleWithRunsCh.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(exampleWithRunsCh.datasetId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(exampleWithRunsCh._inputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRunsCh.inputs())
.isEqualTo(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRunsCh.name()).isEqualTo("name")
assertThat(exampleWithRunsCh.runs())
.containsExactly(
@@ -90,28 +143,60 @@ internal class ExampleWithRunsChTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -120,14 +205,28 @@ internal class ExampleWithRunsChTest {
.traceMinStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
assertThat(exampleWithRunsCh._attachmentUrls())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRunsCh.attachmentUrls())
.contains(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRunsCh.createdAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(exampleWithRunsCh._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRunsCh.metadata())
.contains(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRunsCh.modifiedAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(exampleWithRunsCh._outputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRunsCh.outputs())
.contains(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRunsCh.sourceRunId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}
@@ -138,7 +237,11 @@ internal class ExampleWithRunsChTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -154,28 +257,60 @@ internal class ExampleWithRunsChTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -184,11 +319,23 @@ internal class ExampleWithRunsChTest {
.traceMinStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
@@ -17,7 +17,11 @@ internal class ExampleWithRunsTest {
ExampleWithRuns.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRuns.Run.builder()
@@ -45,25 +49,49 @@ internal class ExampleWithRunsTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRuns.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRuns.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRuns.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRuns.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRuns.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -81,8 +109,16 @@ internal class ExampleWithRunsTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRuns.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRuns.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -97,17 +133,34 @@ internal class ExampleWithRunsTest {
.ttlSeconds(0L)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRuns.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRuns.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
assertThat(exampleWithRuns.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(exampleWithRuns.datasetId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(exampleWithRuns._inputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRuns.inputs())
.isEqualTo(
ExampleWithRuns.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRuns.name()).isEqualTo("name")
assertThat(exampleWithRuns.runs())
.containsExactly(
@@ -136,25 +189,49 @@ internal class ExampleWithRunsTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRuns.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRuns.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRuns.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRuns.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRuns.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -172,8 +249,16 @@ internal class ExampleWithRunsTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRuns.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRuns.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -188,14 +273,28 @@ internal class ExampleWithRunsTest {
.ttlSeconds(0L)
.build()
)
assertThat(exampleWithRuns._attachmentUrls())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRuns.attachmentUrls())
.contains(
ExampleWithRuns.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRuns.createdAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(exampleWithRuns._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRuns.metadata())
.contains(
ExampleWithRuns.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRuns.modifiedAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(exampleWithRuns._outputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleWithRuns.outputs())
.contains(
ExampleWithRuns.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleWithRuns.sourceRunId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}
@@ -206,7 +305,11 @@ internal class ExampleWithRunsTest {
ExampleWithRuns.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRuns.Run.builder()
@@ -234,25 +337,49 @@ internal class ExampleWithRunsTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRuns.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRuns.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRuns.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRuns.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRuns.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -270,8 +397,16 @@ internal class ExampleWithRunsTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRuns.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRuns.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -286,11 +421,23 @@ internal class ExampleWithRunsTest {
.ttlSeconds(0L)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRuns.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRuns.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
@@ -22,7 +22,11 @@ internal class RunCreateResponseTest {
ExampleWithRuns.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRuns.Run.builder()
@@ -50,28 +54,52 @@ internal class RunCreateResponseTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRuns.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRuns.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRuns.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRuns.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRuns.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -89,8 +117,16 @@ internal class RunCreateResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRuns.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRuns.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -105,11 +141,23 @@ internal class RunCreateResponseTest {
.ttlSeconds(0L)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRuns.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRuns.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -129,7 +177,11 @@ internal class RunCreateResponseTest {
ExampleWithRuns.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRuns.Run.builder()
@@ -157,28 +209,52 @@ internal class RunCreateResponseTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRuns.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRuns.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRuns.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRuns.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRuns.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRuns.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -196,8 +272,16 @@ internal class RunCreateResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRuns.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRuns.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -214,11 +298,23 @@ internal class RunCreateResponseTest {
.ttlSeconds(0L)
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRuns.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRuns.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRuns.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -240,7 +336,11 @@ internal class RunCreateResponseTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -256,31 +356,63 @@ internal class RunCreateResponseTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -289,11 +421,23 @@ internal class RunCreateResponseTest {
.traceMinStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -313,7 +457,11 @@ internal class RunCreateResponseTest {
ExampleWithRunsCh.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.addRun(
ExampleWithRunsCh.Run.builder()
@@ -329,31 +477,63 @@ internal class RunCreateResponseTest {
.dottedOrder("dotted_order")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
ExampleWithRunsCh.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
ExampleWithRunsCh.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
ExampleWithRunsCh.Run.FeedbackStats.builder()
.putAdditionalProperty(
"foo",
JsonValue.from(mapOf<String, Any>()),
JsonValue.from(mapOf("foo" to "bar")),
)
.build()
)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleWithRunsCh.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
ExampleWithRunsCh.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
ExampleWithRunsCh.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.promptCost("prompt_cost")
.promptTokens(0L)
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
ExampleWithRunsCh.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
ExampleWithRunsCh.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.totalCost("total_cost")
@@ -362,11 +542,23 @@ internal class RunCreateResponseTest {
.traceMinStartTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
ExampleWithRunsCh.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ExampleWithRunsCh.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
ExampleWithRunsCh.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
@@ -15,9 +15,21 @@ internal class ExampleCreateParamsTest {
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt("created_at")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleCreateParams.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
ExampleCreateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
ExampleCreateParams.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
.useLegacyMessageFormat(true)
@@ -33,9 +45,21 @@ internal class ExampleCreateParamsTest {
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt("created_at")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleCreateParams.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
ExampleCreateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
ExampleCreateParams.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
.useLegacyMessageFormat(true)
@@ -48,9 +72,24 @@ internal class ExampleCreateParamsTest {
assertThat(body.datasetId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.id()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.createdAt()).contains("created_at")
assertThat(body._inputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body._outputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.inputs())
.contains(
ExampleCreateParams.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.metadata())
.contains(
ExampleCreateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.outputs())
.contains(
ExampleCreateParams.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.sourceRunId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.split()).contains(ExampleCreateParams.Split.ofStrings(listOf("string")))
assertThat(body.useLegacyMessageFormat()).contains(true)
@@ -17,25 +17,59 @@ internal class ExampleTest {
Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
Example.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
Example.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
assertThat(example.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(example.datasetId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(example._inputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(example.inputs())
.isEqualTo(
Example.Inputs.builder().putAdditionalProperty("foo", JsonValue.from("bar")).build()
)
assertThat(example.name()).isEqualTo("name")
assertThat(example._attachmentUrls()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(example.attachmentUrls())
.contains(
Example.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(example.createdAt()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(example._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(example.metadata())
.contains(
Example.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(example.modifiedAt()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(example._outputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(example.outputs())
.contains(
Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(example.sourceRunId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}
@@ -46,13 +80,29 @@ internal class ExampleTest {
Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.attachmentUrls(JsonValue.from(mapOf<String, Any>()))
.attachmentUrls(
Example.AttachmentUrls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
Example.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
@@ -23,9 +23,21 @@ internal class ExampleUpdateParamsTest {
.build()
)
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleUpdateParams.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
ExampleUpdateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
ExampleUpdateParams.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.splitOfStrings(listOf("string"))
.build()
@@ -57,9 +69,21 @@ internal class ExampleUpdateParamsTest {
.build()
)
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleUpdateParams.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
ExampleUpdateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
ExampleUpdateParams.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.splitOfStrings(listOf("string"))
.build()
@@ -78,9 +102,24 @@ internal class ExampleUpdateParamsTest {
.build()
)
assertThat(body.datasetId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body._inputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body._outputs()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.inputs())
.contains(
ExampleUpdateParams.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.metadata())
.contains(
ExampleUpdateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.outputs())
.contains(
ExampleUpdateParams.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body.overwrite()).contains(true)
assertThat(body.split()).contains(ExampleUpdateParams.Split.ofStrings(listOf("string")))
}
@@ -16,9 +16,21 @@ internal class BulkCreateParamsTest {
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt("created_at")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
BulkCreateParams.Body.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
BulkCreateParams.Body.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
BulkCreateParams.Body.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
.useLegacyMessageFormat(true)
@@ -38,9 +50,21 @@ internal class BulkCreateParamsTest {
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt("created_at")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
BulkCreateParams.Body.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
BulkCreateParams.Body.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
BulkCreateParams.Body.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
.useLegacyMessageFormat(true)
@@ -58,9 +82,21 @@ internal class BulkCreateParamsTest {
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt("created_at")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
BulkCreateParams.Body.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
BulkCreateParams.Body.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
BulkCreateParams.Body.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
.useLegacyMessageFormat(true)
@@ -26,9 +26,21 @@ internal class BulkPatchAllParamsTest {
.build()
)
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
BulkPatchAllParams.Body.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
BulkPatchAllParams.Body.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
BulkPatchAllParams.Body.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.splitOfStrings(listOf("string"))
.build()
@@ -54,9 +66,21 @@ internal class BulkPatchAllParamsTest {
.build()
)
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
BulkPatchAllParams.Body.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
BulkPatchAllParams.Body.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
BulkPatchAllParams.Body.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.splitOfStrings(listOf("string"))
.build()
@@ -80,9 +104,21 @@ internal class BulkPatchAllParamsTest {
.build()
)
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
BulkPatchAllParams.Body.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
BulkPatchAllParams.Body.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
BulkPatchAllParams.Body.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.splitOfStrings(listOf("string"))
.build()
@@ -18,9 +18,21 @@ internal class ExampleValidationResultTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleValidationResult.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
ExampleValidationResult.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
ExampleValidationResult.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
@@ -32,12 +44,24 @@ internal class ExampleValidationResultTest {
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(exampleValidationResult.datasetId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(exampleValidationResult._inputs())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleValidationResult._metadata())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleValidationResult._outputs())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(exampleValidationResult.inputs())
.contains(
ExampleValidationResult.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleValidationResult.metadata())
.contains(
ExampleValidationResult.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleValidationResult.outputs())
.contains(
ExampleValidationResult.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(exampleValidationResult.overwrite()).contains(true)
assertThat(exampleValidationResult.sourceRunId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -54,9 +78,21 @@ internal class ExampleValidationResultTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.datasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
ExampleValidationResult.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
ExampleValidationResult.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
ExampleValidationResult.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overwrite(true)
.sourceRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.splitOfStrings(listOf("string"))
@@ -14,11 +14,20 @@ internal class ApiFeedbackSourceTest {
fun create() {
val apiFeedbackSource =
ApiFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ApiFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(ApiFeedbackSource.Type.API)
.build()
assertThat(apiFeedbackSource._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(apiFeedbackSource.metadata())
.contains(
ApiFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(apiFeedbackSource.type()).contains(ApiFeedbackSource.Type.API)
}
@@ -27,7 +36,11 @@ internal class ApiFeedbackSourceTest {
val jsonMapper = jsonMapper()
val apiFeedbackSource =
ApiFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ApiFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(ApiFeedbackSource.Type.API)
.build()
@@ -14,11 +14,20 @@ internal class AppFeedbackSourceTest {
fun create() {
val appFeedbackSource =
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
assertThat(appFeedbackSource._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(appFeedbackSource.metadata())
.contains(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(appFeedbackSource.type()).contains(AppFeedbackSource.Type.APP)
}
@@ -27,7 +36,11 @@ internal class AppFeedbackSourceTest {
val jsonMapper = jsonMapper()
val appFeedbackSource =
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
@@ -14,12 +14,20 @@ internal class AutoEvalFeedbackSourceTest {
fun create() {
val autoEvalFeedbackSource =
AutoEvalFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AutoEvalFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AutoEvalFeedbackSource.Type.AUTO_EVAL)
.build()
assertThat(autoEvalFeedbackSource._metadata())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(autoEvalFeedbackSource.metadata())
.contains(
AutoEvalFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(autoEvalFeedbackSource.type()).contains(AutoEvalFeedbackSource.Type.AUTO_EVAL)
}
@@ -28,7 +36,11 @@ internal class AutoEvalFeedbackSourceTest {
val jsonMapper = jsonMapper()
val autoEvalFeedbackSource =
AutoEvalFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AutoEvalFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AutoEvalFeedbackSource.Type.AUTO_EVAL)
.build()
@@ -18,7 +18,11 @@ internal class FeedbackCreateParamsTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error(true)
.feedbackConfig(
@@ -37,7 +41,11 @@ internal class FeedbackCreateParamsTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -62,7 +70,11 @@ internal class FeedbackCreateParamsTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error(true)
.feedbackConfig(
@@ -81,7 +93,11 @@ internal class FeedbackCreateParamsTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -104,7 +120,11 @@ internal class FeedbackCreateParamsTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error(true)
.feedbackConfig(
@@ -123,7 +143,11 @@ internal class FeedbackCreateParamsTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -19,7 +19,11 @@ internal class FeedbackCreateSchemaTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error(true)
.feedbackConfig(
@@ -38,7 +42,11 @@ internal class FeedbackCreateSchemaTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -57,7 +65,11 @@ internal class FeedbackCreateSchemaTest {
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(feedbackCreateSchema.correction())
.contains(
FeedbackCreateSchema.Correction.ofJsonValue(JsonValue.from(mapOf<String, Any>()))
FeedbackCreateSchema.Correction.ofUnionMember0(
FeedbackCreateSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(feedbackCreateSchema.createdAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
@@ -82,7 +94,11 @@ internal class FeedbackCreateSchemaTest {
.contains(
FeedbackCreateSchema.FeedbackSource.ofApp(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -106,7 +122,11 @@ internal class FeedbackCreateSchemaTest {
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackCreateSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error(true)
.feedbackConfig(
@@ -125,7 +145,11 @@ internal class FeedbackCreateSchemaTest {
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
AppFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
AppFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(AppFeedbackSource.Type.APP)
.build()
)
@@ -19,14 +19,26 @@ internal class FeedbackSchemaTest {
.key("key")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
FeedbackSchema.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
FeedbackSchema.FeedbackSource.builder()
.lsUserId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
FeedbackSchema.FeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type("type")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userName("user_name")
@@ -48,17 +60,32 @@ internal class FeedbackSchemaTest {
assertThat(feedbackSchema.comparativeExperimentId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(feedbackSchema.correction())
.contains(FeedbackSchema.Correction.ofJsonValue(JsonValue.from(mapOf<String, Any>())))
.contains(
FeedbackSchema.Correction.ofUnionMember0(
FeedbackSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(feedbackSchema.createdAt())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(feedbackSchema._extra()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(feedbackSchema.extra())
.contains(
FeedbackSchema.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(feedbackSchema.feedbackGroupId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(feedbackSchema.feedbackSource())
.contains(
FeedbackSchema.FeedbackSource.builder()
.lsUserId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
FeedbackSchema.FeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type("type")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userName("user_name")
@@ -85,14 +112,26 @@ internal class FeedbackSchemaTest {
.key("key")
.comment("comment")
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackSchema.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
FeedbackSchema.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackGroupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.feedbackSource(
FeedbackSchema.FeedbackSource.builder()
.lsUserId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
FeedbackSchema.FeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type("type")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userName("user_name")
@@ -13,7 +13,11 @@ internal class FeedbackUpdateParamsTest {
FeedbackUpdateParams.builder()
.feedbackId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackUpdateParams.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackConfig(
FeedbackUpdateParams.FeedbackConfig.builder()
.type(FeedbackUpdateParams.FeedbackConfig.Type.CONTINUOUS)
@@ -50,7 +54,11 @@ internal class FeedbackUpdateParamsTest {
FeedbackUpdateParams.builder()
.feedbackId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.correction(JsonValue.from(mapOf<String, Any>()))
.correction(
FeedbackUpdateParams.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackConfig(
FeedbackUpdateParams.FeedbackConfig.builder()
.type(FeedbackUpdateParams.FeedbackConfig.Type.CONTINUOUS)
@@ -73,7 +81,11 @@ internal class FeedbackUpdateParamsTest {
assertThat(body.comment()).contains("comment")
assertThat(body.correction())
.contains(
FeedbackUpdateParams.Correction.ofJsonValue(JsonValue.from(mapOf<String, Any>()))
FeedbackUpdateParams.Correction.ofUnionMember0(
FeedbackUpdateParams.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(body.feedbackConfig())
.contains(
@@ -14,11 +14,20 @@ internal class ModelFeedbackSourceTest {
fun create() {
val modelFeedbackSource =
ModelFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ModelFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(ModelFeedbackSource.Type.MODEL)
.build()
assertThat(modelFeedbackSource._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(modelFeedbackSource.metadata())
.contains(
ModelFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(modelFeedbackSource.type()).contains(ModelFeedbackSource.Type.MODEL)
}
@@ -27,7 +36,11 @@ internal class ModelFeedbackSourceTest {
val jsonMapper = jsonMapper()
val modelFeedbackSource =
ModelFeedbackSource.builder()
.metadata(JsonValue.from(mapOf<String, Any>()))
.metadata(
ModelFeedbackSource.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.type(ModelFeedbackSource.Type.MODEL)
.build()
@@ -13,8 +13,16 @@ internal class TokenUpdateParamsTest {
TokenUpdateParams.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.correction(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.correction(
TokenUpdateParams.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
TokenUpdateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.score(0.0)
.value(0.0)
.build()
@@ -36,8 +44,16 @@ internal class TokenUpdateParamsTest {
TokenUpdateParams.builder()
.token("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.comment("comment")
.correction(JsonValue.from(mapOf<String, Any>()))
.metadata(JsonValue.from(mapOf<String, Any>()))
.correction(
TokenUpdateParams.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.metadata(
TokenUpdateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.score(0.0)
.value(0.0)
.build()
@@ -47,9 +63,18 @@ internal class TokenUpdateParamsTest {
assertThat(body.comment()).contains("comment")
assertThat(body.correction())
.contains(
TokenUpdateParams.Correction.ofJsonValue(JsonValue.from(mapOf<String, Any>()))
TokenUpdateParams.Correction.ofUnionMember0(
TokenUpdateParams.Correction.UnionMember0.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
)
assertThat(body.metadata())
.contains(
TokenUpdateParams.Metadata.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(body._metadata()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(body.score()).contains(TokenUpdateParams.Score.ofNumber(0.0))
assertThat(body.value()).contains(TokenUpdateParams.Value.ofNumber(0.0))
}
@@ -26,8 +26,16 @@ internal class DatasetListComparativeResponseTest {
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
DatasetListComparativeResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
DatasetListComparativeResponse.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.build()
@@ -45,10 +53,18 @@ internal class DatasetListComparativeResponseTest {
assertThat(datasetListComparativeResponse.modifiedAt())
.isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(datasetListComparativeResponse.description()).contains("description")
assertThat(datasetListComparativeResponse._extra())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(datasetListComparativeResponse._feedbackStats())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(datasetListComparativeResponse.extra())
.contains(
DatasetListComparativeResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(datasetListComparativeResponse.feedbackStats())
.contains(
DatasetListComparativeResponse.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(datasetListComparativeResponse.name()).contains("name")
}
@@ -67,8 +83,16 @@ internal class DatasetListComparativeResponseTest {
)
.modifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.description("description")
.extra(JsonValue.from(mapOf<String, Any>()))
.feedbackStats(JsonValue.from(mapOf<String, Any>()))
.extra(
DatasetListComparativeResponse.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
DatasetListComparativeResponse.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.name("name")
.build()
@@ -25,8 +25,16 @@ internal class DatasetListResponseTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
DatasetListResponse.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
DatasetListResponse.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -45,10 +53,18 @@ internal class DatasetListResponseTest {
assertThat(datasetListResponse.dataType()).contains(DataType.KV)
assertThat(datasetListResponse.description()).contains("description")
assertThat(datasetListResponse.externallyManaged()).contains(true)
assertThat(datasetListResponse._inputsSchemaDefinition())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(datasetListResponse._outputsSchemaDefinition())
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(datasetListResponse.inputsSchemaDefinition())
.contains(
DatasetListResponse.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(datasetListResponse.outputsSchemaDefinition())
.contains(
DatasetListResponse.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(datasetListResponse.transformations().getOrNull())
.containsExactly(
DatasetTransformation.builder()
@@ -72,8 +88,16 @@ internal class DatasetListResponseTest {
.dataType(DataType.KV)
.description("description")
.externallyManaged(true)
.inputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.outputsSchemaDefinition(JsonValue.from(mapOf<String, Any>()))
.inputsSchemaDefinition(
DatasetListResponse.InputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsSchemaDefinition(
DatasetListResponse.OutputsSchemaDefinition.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addTransformation(
DatasetTransformation.builder()
.addPath("string")
@@ -37,13 +37,25 @@ internal class CreateRepoResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -81,13 +93,25 @@ internal class CreateRepoResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -129,13 +153,25 @@ internal class CreateRepoResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -14,15 +14,33 @@ internal class DemoConfigTest {
fun create() {
val demoConfig =
DemoConfig.builder()
.addExample(JsonValue.from(mapOf<String, Any>()))
.addExample(
DemoConfig.Example.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.messageIndex(0L)
.metaprompt(JsonValue.from(mapOf<String, Any>()))
.metaprompt(
DemoConfig.Metaprompt.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overallFeedback("overall_feedback")
.build()
assertThat(demoConfig.examples()).containsExactly(JsonValue.from(mapOf<String, Any>()))
assertThat(demoConfig.examples())
.containsExactly(
DemoConfig.Example.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(demoConfig.messageIndex()).isEqualTo(0L)
assertThat(demoConfig._metaprompt()).isEqualTo(JsonValue.from(mapOf<String, Any>()))
assertThat(demoConfig.metaprompt())
.isEqualTo(
DemoConfig.Metaprompt.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
assertThat(demoConfig.overallFeedback()).contains("overall_feedback")
}
@@ -31,9 +49,17 @@ internal class DemoConfigTest {
val jsonMapper = jsonMapper()
val demoConfig =
DemoConfig.builder()
.addExample(JsonValue.from(mapOf<String, Any>()))
.addExample(
DemoConfig.Example.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.messageIndex(0L)
.metaprompt(JsonValue.from(mapOf<String, Any>()))
.metaprompt(
DemoConfig.Metaprompt.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.overallFeedback("overall_feedback")
.build()
@@ -37,13 +37,25 @@ internal class GetRepoResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -81,13 +93,25 @@ internal class GetRepoResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -129,13 +153,25 @@ internal class GetRepoResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -37,13 +37,25 @@ internal class RepoListPageResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -82,13 +94,25 @@ internal class RepoListPageResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -131,13 +155,25 @@ internal class RepoListPageResponseTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -35,13 +35,25 @@ internal class RepoWithLookupsTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -77,13 +89,25 @@ internal class RepoWithLookupsTest {
.contains(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -123,13 +147,25 @@ internal class RepoWithLookupsTest {
.latestCommitManifest(
CommitManifestResponse.builder()
.commitHash("commit_hash")
.manifest(JsonValue.from(mapOf<String, Any>()))
.manifest(
CommitManifestResponse.Manifest.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.addExample(
CommitManifestResponse.Example.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.inputs(JsonValue.from(mapOf<String, Any>()))
.outputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
CommitManifestResponse.Example.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputs(
CommitManifestResponse.Example.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.build()
)
@@ -46,25 +46,49 @@ internal class RunQueryResponseTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
RunQueryResponse.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
RunQueryResponse.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
RunQueryResponse.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
RunQueryResponse.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
RunQueryResponse.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
RunQueryResponse.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
RunQueryResponse.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -82,8 +106,16 @@ internal class RunQueryResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
RunQueryResponse.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
RunQueryResponse.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -139,25 +171,49 @@ internal class RunQueryResponseTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
RunQueryResponse.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
RunQueryResponse.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
RunQueryResponse.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
RunQueryResponse.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
RunQueryResponse.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
RunQueryResponse.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
RunQueryResponse.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -175,8 +231,16 @@ internal class RunQueryResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
RunQueryResponse.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
RunQueryResponse.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
@@ -236,25 +300,49 @@ internal class RunQueryResponseTest {
.addDirectChildRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.endTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.error("error")
.addEvent(JsonValue.from(mapOf<String, Any>()))
.addEvent(
RunQueryResponse.Run.Event.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.executionOrder(1L)
.extra(JsonValue.from(mapOf<String, Any>()))
.extra(
RunQueryResponse.Run.Extra.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.feedbackStats(
RunQueryResponse.Run.FeedbackStats.builder()
.putAdditionalProperty("foo", JsonValue.from(mapOf<String, Any>()))
.putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar")))
.build()
)
.firstTokenTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.inDataset(true)
.inputs(JsonValue.from(mapOf<String, Any>()))
.inputs(
RunQueryResponse.Run.Inputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.inputsPreview("inputs_preview")
.inputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.inputsS3Urls(
RunQueryResponse.Run.InputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.lastQueuedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.manifestId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.manifestS3Id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.outputs(JsonValue.from(mapOf<String, Any>()))
.outputs(
RunQueryResponse.Run.Outputs.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.outputsPreview("outputs_preview")
.outputsS3Urls(JsonValue.from(mapOf<String, Any>()))
.outputsS3Urls(
RunQueryResponse.Run.OutputsS3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.parentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addParentRunId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.priceModelId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -272,8 +360,16 @@ internal class RunQueryResponseTest {
.promptTokens(0L)
.referenceDatasetId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.referenceExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.s3Urls(JsonValue.from(mapOf<String, Any>()))
.serialized(JsonValue.from(mapOf<String, Any>()))
.s3Urls(
RunQueryResponse.Run.S3Urls.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.serialized(
RunQueryResponse.Run.Serialized.builder()
.putAdditionalProperty("foo", JsonValue.from("bar"))
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")

Some files were not shown because too many files have changed in this diff Show More