feat(api): api update

This commit is contained in:
stainless-app[bot]
2026-05-04 19:15:12 +00:00
committed by meorphis
parent 020f9f6db6
commit b5a32009fc
6 changed files with 412 additions and 20 deletions
@@ -76,6 +76,7 @@ private constructor(
private val s3Urls: JsonField<S3Urls>,
private val serialized: JsonField<Serialized>,
private val shareToken: JsonField<String>,
private val sourceProposedExampleId: JsonField<String>,
private val startTime: JsonField<OffsetDateTime>,
private val tags: JsonField<List<String>>,
private val threadId: JsonField<String>,
@@ -218,6 +219,9 @@ private constructor(
@JsonProperty("share_token")
@ExcludeMissing
shareToken: JsonField<String> = JsonMissing.of(),
@JsonProperty("source_proposed_example_id")
@ExcludeMissing
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
@JsonProperty("start_time")
@ExcludeMissing
startTime: JsonField<OffsetDateTime> = JsonMissing.of(),
@@ -294,6 +298,7 @@ private constructor(
s3Urls,
serialized,
shareToken,
sourceProposedExampleId,
startTime,
tags,
threadId,
@@ -619,6 +624,13 @@ private constructor(
*/
fun shareToken(): Optional<String> = shareToken.getOptional("share_token")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun sourceProposedExampleId(): Optional<String> =
sourceProposedExampleId.getOptional("source_proposed_example_id")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -1106,6 +1118,16 @@ private constructor(
*/
@JsonProperty("share_token") @ExcludeMissing fun _shareToken(): JsonField<String> = shareToken
/**
* Returns the raw JSON value of [sourceProposedExampleId].
*
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("source_proposed_example_id")
@ExcludeMissing
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
/**
* Returns the raw JSON value of [startTime].
*
@@ -1283,6 +1305,7 @@ private constructor(
private var s3Urls: JsonField<S3Urls> = JsonMissing.of()
private var serialized: JsonField<Serialized> = JsonMissing.of()
private var shareToken: JsonField<String> = JsonMissing.of()
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
private var startTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var tags: JsonField<MutableList<String>>? = null
private var threadId: JsonField<String> = JsonMissing.of()
@@ -1353,6 +1376,7 @@ private constructor(
s3Urls = runSchemaWithAnnotationQueueInfo.s3Urls
serialized = runSchemaWithAnnotationQueueInfo.serialized
shareToken = runSchemaWithAnnotationQueueInfo.shareToken
sourceProposedExampleId = runSchemaWithAnnotationQueueInfo.sourceProposedExampleId
startTime = runSchemaWithAnnotationQueueInfo.startTime
tags = runSchemaWithAnnotationQueueInfo.tags.map { it.toMutableList() }
threadId = runSchemaWithAnnotationQueueInfo.threadId
@@ -2212,6 +2236,27 @@ private constructor(
*/
fun shareToken(shareToken: JsonField<String>) = apply { this.shareToken = shareToken }
fun sourceProposedExampleId(sourceProposedExampleId: String?) =
sourceProposedExampleId(JsonField.ofNullable(sourceProposedExampleId))
/**
* Alias for calling [Builder.sourceProposedExampleId] with
* `sourceProposedExampleId.orElse(null)`.
*/
fun sourceProposedExampleId(sourceProposedExampleId: Optional<String>) =
sourceProposedExampleId(sourceProposedExampleId.getOrNull())
/**
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
*
* You should usually call [Builder.sourceProposedExampleId] with a well-typed [String]
* value instead. This method is primarily for setting the field to an undocumented or not
* yet supported value.
*/
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
this.sourceProposedExampleId = sourceProposedExampleId
}
fun startTime(startTime: OffsetDateTime) = startTime(JsonField.of(startTime))
/**
@@ -2481,6 +2526,7 @@ private constructor(
s3Urls,
serialized,
shareToken,
sourceProposedExampleId,
startTime,
(tags ?: JsonMissing.of()).map { it.toImmutable() },
threadId,
@@ -2561,6 +2607,7 @@ private constructor(
s3Urls().ifPresent { it.validate() }
serialized().ifPresent { it.validate() }
shareToken()
sourceProposedExampleId()
startTime()
tags()
threadId()
@@ -2640,6 +2687,7 @@ private constructor(
(s3Urls.asKnown().getOrNull()?.validity() ?: 0) +
(serialized.asKnown().getOrNull()?.validity() ?: 0) +
(if (shareToken.asKnown().isPresent) 1 else 0) +
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0) +
(if (startTime.asKnown().isPresent) 1 else 0) +
(tags.asKnown().getOrNull()?.size ?: 0) +
(if (threadId.asKnown().isPresent) 1 else 0) +
@@ -4368,6 +4416,7 @@ private constructor(
s3Urls == other.s3Urls &&
serialized == other.serialized &&
shareToken == other.shareToken &&
sourceProposedExampleId == other.sourceProposedExampleId &&
startTime == other.startTime &&
tags == other.tags &&
threadId == other.threadId &&
@@ -4434,6 +4483,7 @@ private constructor(
s3Urls,
serialized,
shareToken,
sourceProposedExampleId,
startTime,
tags,
threadId,
@@ -4452,5 +4502,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
"RunSchemaWithAnnotationQueueInfo{id=$id, appPath=$appPath, dottedOrder=$dottedOrder, name=$name, queueRunId=$queueRunId, runType=$runType, sessionId=$sessionId, status=$status, traceId=$traceId, addedAt=$addedAt, childRunIds=$childRunIds, completedBy=$completedBy, completionCost=$completionCost, completionCostDetails=$completionCostDetails, completionTokenDetails=$completionTokenDetails, completionTokens=$completionTokens, directChildRunIds=$directChildRunIds, effectiveAddedAt=$effectiveAddedAt, endTime=$endTime, error=$error, events=$events, executionOrder=$executionOrder, extra=$extra, feedbackStats=$feedbackStats, firstTokenTime=$firstTokenTime, inDataset=$inDataset, inputs=$inputs, inputsPreview=$inputsPreview, inputsS3Urls=$inputsS3Urls, lastQueuedAt=$lastQueuedAt, lastReviewedTime=$lastReviewedTime, manifestId=$manifestId, manifestS3Id=$manifestS3Id, messages=$messages, outputs=$outputs, outputsPreview=$outputsPreview, outputsS3Urls=$outputsS3Urls, parentRunId=$parentRunId, parentRunIds=$parentRunIds, priceModelId=$priceModelId, promptCost=$promptCost, promptCostDetails=$promptCostDetails, promptTokenDetails=$promptTokenDetails, promptTokens=$promptTokens, referenceDatasetId=$referenceDatasetId, referenceExampleId=$referenceExampleId, reservedBy=$reservedBy, s3Urls=$s3Urls, serialized=$serialized, shareToken=$shareToken, startTime=$startTime, tags=$tags, threadId=$threadId, totalCost=$totalCost, totalTokens=$totalTokens, traceFirstReceivedAt=$traceFirstReceivedAt, traceMaxStartTime=$traceMaxStartTime, traceMinStartTime=$traceMinStartTime, traceTier=$traceTier, traceUpgrade=$traceUpgrade, ttlSeconds=$ttlSeconds, additionalProperties=$additionalProperties}"
"RunSchemaWithAnnotationQueueInfo{id=$id, appPath=$appPath, dottedOrder=$dottedOrder, name=$name, queueRunId=$queueRunId, runType=$runType, sessionId=$sessionId, status=$status, traceId=$traceId, addedAt=$addedAt, childRunIds=$childRunIds, completedBy=$completedBy, completionCost=$completionCost, completionCostDetails=$completionCostDetails, completionTokenDetails=$completionTokenDetails, completionTokens=$completionTokens, directChildRunIds=$directChildRunIds, effectiveAddedAt=$effectiveAddedAt, endTime=$endTime, error=$error, events=$events, executionOrder=$executionOrder, extra=$extra, feedbackStats=$feedbackStats, firstTokenTime=$firstTokenTime, inDataset=$inDataset, inputs=$inputs, inputsPreview=$inputsPreview, inputsS3Urls=$inputsS3Urls, lastQueuedAt=$lastQueuedAt, lastReviewedTime=$lastReviewedTime, manifestId=$manifestId, manifestS3Id=$manifestS3Id, messages=$messages, outputs=$outputs, outputsPreview=$outputsPreview, outputsS3Urls=$outputsS3Urls, parentRunId=$parentRunId, parentRunIds=$parentRunIds, priceModelId=$priceModelId, promptCost=$promptCost, promptCostDetails=$promptCostDetails, promptTokenDetails=$promptTokenDetails, promptTokens=$promptTokens, referenceDatasetId=$referenceDatasetId, referenceExampleId=$referenceExampleId, reservedBy=$reservedBy, s3Urls=$s3Urls, serialized=$serialized, shareToken=$shareToken, sourceProposedExampleId=$sourceProposedExampleId, startTime=$startTime, tags=$tags, threadId=$threadId, totalCost=$totalCost, totalTokens=$totalTokens, traceFirstReceivedAt=$traceFirstReceivedAt, traceMaxStartTime=$traceMaxStartTime, traceMinStartTime=$traceMinStartTime, traceTier=$traceTier, traceUpgrade=$traceUpgrade, ttlSeconds=$ttlSeconds, additionalProperties=$additionalProperties}"
}
@@ -100,9 +100,17 @@ private constructor(
* `Body.ofRunsAnnotationQueueRunAddSchemaArray(runsAnnotationQueueRunAddSchemaArray)`.
*/
fun bodyOfRunsAnnotationQueueRunAddSchemaArray(
runsAnnotationQueueRunAddSchemaArray: List<Body.AnnotationQueueRunAddSchema>
runsAnnotationQueueRunAddSchemaArray: List<Body.AddRunToQueueRequest>
) = body(Body.ofRunsAnnotationQueueRunAddSchemaArray(runsAnnotationQueueRunAddSchemaArray))
/**
* Alias for calling [body] with
* `Body.ofAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas)`.
*/
fun bodyOfAnnotationQueueRunAddSchemas(
annotationQueueRunAddSchemas: List<Body.AnnotationQueueRunAddSchema>
) = body(Body.ofAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas))
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
putAllAdditionalHeaders(additionalHeaders)
@@ -239,25 +247,34 @@ private constructor(
class Body
private constructor(
private val runsUuidArray: List<String>? = null,
private val runsAnnotationQueueRunAddSchemaArray: List<AnnotationQueueRunAddSchema>? = null,
private val runsAnnotationQueueRunAddSchemaArray: List<AddRunToQueueRequest>? = null,
private val annotationQueueRunAddSchemas: List<AnnotationQueueRunAddSchema>? = null,
private val _json: JsonValue? = null,
) {
fun runsUuidArray(): Optional<List<String>> = Optional.ofNullable(runsUuidArray)
fun runsAnnotationQueueRunAddSchemaArray(): Optional<List<AnnotationQueueRunAddSchema>> =
fun runsAnnotationQueueRunAddSchemaArray(): Optional<List<AddRunToQueueRequest>> =
Optional.ofNullable(runsAnnotationQueueRunAddSchemaArray)
fun annotationQueueRunAddSchemas(): Optional<List<AnnotationQueueRunAddSchema>> =
Optional.ofNullable(annotationQueueRunAddSchemas)
fun isRunsUuidArray(): Boolean = runsUuidArray != null
fun isRunsAnnotationQueueRunAddSchemaArray(): Boolean =
runsAnnotationQueueRunAddSchemaArray != null
fun isAnnotationQueueRunAddSchemas(): Boolean = annotationQueueRunAddSchemas != null
fun asRunsUuidArray(): List<String> = runsUuidArray.getOrThrow("runsUuidArray")
fun asRunsAnnotationQueueRunAddSchemaArray(): List<AnnotationQueueRunAddSchema> =
fun asRunsAnnotationQueueRunAddSchemaArray(): List<AddRunToQueueRequest> =
runsAnnotationQueueRunAddSchemaArray.getOrThrow("runsAnnotationQueueRunAddSchemaArray")
fun asAnnotationQueueRunAddSchemas(): List<AnnotationQueueRunAddSchema> =
annotationQueueRunAddSchemas.getOrThrow("annotationQueueRunAddSchemas")
fun _json(): Optional<JsonValue> = Optional.ofNullable(_json)
/**
@@ -296,6 +313,8 @@ private constructor(
visitor.visitRunsAnnotationQueueRunAddSchemaArray(
runsAnnotationQueueRunAddSchemaArray
)
annotationQueueRunAddSchemas != null ->
visitor.visitAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas)
else -> visitor.unknown(_json)
}
@@ -320,10 +339,16 @@ private constructor(
override fun visitRunsUuidArray(runsUuidArray: List<String>) {}
override fun visitRunsAnnotationQueueRunAddSchemaArray(
runsAnnotationQueueRunAddSchemaArray: List<AnnotationQueueRunAddSchema>
runsAnnotationQueueRunAddSchemaArray: List<AddRunToQueueRequest>
) {
runsAnnotationQueueRunAddSchemaArray.forEach { it.validate() }
}
override fun visitAnnotationQueueRunAddSchemas(
annotationQueueRunAddSchemas: List<AnnotationQueueRunAddSchema>
) {
annotationQueueRunAddSchemas.forEach { it.validate() }
}
}
)
validated = true
@@ -351,9 +376,13 @@ private constructor(
runsUuidArray.size
override fun visitRunsAnnotationQueueRunAddSchemaArray(
runsAnnotationQueueRunAddSchemaArray: List<AnnotationQueueRunAddSchema>
runsAnnotationQueueRunAddSchemaArray: List<AddRunToQueueRequest>
) = runsAnnotationQueueRunAddSchemaArray.sumOf { it.validity().toInt() }
override fun visitAnnotationQueueRunAddSchemas(
annotationQueueRunAddSchemas: List<AnnotationQueueRunAddSchema>
) = annotationQueueRunAddSchemas.sumOf { it.validity().toInt() }
override fun unknown(json: JsonValue?) = 0
}
)
@@ -365,17 +394,25 @@ private constructor(
return other is Body &&
runsUuidArray == other.runsUuidArray &&
runsAnnotationQueueRunAddSchemaArray == other.runsAnnotationQueueRunAddSchemaArray
runsAnnotationQueueRunAddSchemaArray ==
other.runsAnnotationQueueRunAddSchemaArray &&
annotationQueueRunAddSchemas == other.annotationQueueRunAddSchemas
}
override fun hashCode(): Int =
Objects.hash(runsUuidArray, runsAnnotationQueueRunAddSchemaArray)
Objects.hash(
runsUuidArray,
runsAnnotationQueueRunAddSchemaArray,
annotationQueueRunAddSchemas,
)
override fun toString(): String =
when {
runsUuidArray != null -> "Body{runsUuidArray=$runsUuidArray}"
runsAnnotationQueueRunAddSchemaArray != null ->
"Body{runsAnnotationQueueRunAddSchemaArray=$runsAnnotationQueueRunAddSchemaArray}"
annotationQueueRunAddSchemas != null ->
"Body{annotationQueueRunAddSchemas=$annotationQueueRunAddSchemas}"
_json != null -> "Body{_unknown=$_json}"
else -> throw IllegalStateException("Invalid Body")
}
@@ -388,12 +425,17 @@ private constructor(
@JvmStatic
fun ofRunsAnnotationQueueRunAddSchemaArray(
runsAnnotationQueueRunAddSchemaArray: List<AnnotationQueueRunAddSchema>
runsAnnotationQueueRunAddSchemaArray: List<AddRunToQueueRequest>
) =
Body(
runsAnnotationQueueRunAddSchemaArray =
runsAnnotationQueueRunAddSchemaArray.toImmutable()
)
@JvmStatic
fun ofAnnotationQueueRunAddSchemas(
annotationQueueRunAddSchemas: List<AnnotationQueueRunAddSchema>
) = Body(annotationQueueRunAddSchemas = annotationQueueRunAddSchemas.toImmutable())
}
/** An interface that defines how to map each variant of [Body] to a value of type [T]. */
@@ -402,7 +444,11 @@ private constructor(
fun visitRunsUuidArray(runsUuidArray: List<String>): T
fun visitRunsAnnotationQueueRunAddSchemaArray(
runsAnnotationQueueRunAddSchemaArray: List<AnnotationQueueRunAddSchema>
runsAnnotationQueueRunAddSchemaArray: List<AddRunToQueueRequest>
): T
fun visitAnnotationQueueRunAddSchemas(
annotationQueueRunAddSchemas: List<AnnotationQueueRunAddSchema>
): T
/**
@@ -429,13 +475,15 @@ private constructor(
tryDeserialize(node, jacksonTypeRef<List<String>>())?.let {
Body(runsUuidArray = it, _json = json)
},
tryDeserialize(node, jacksonTypeRef<List<AddRunToQueueRequest>>())
?.let {
Body(runsAnnotationQueueRunAddSchemaArray = it, _json = json)
},
tryDeserialize(
node,
jacksonTypeRef<List<AnnotationQueueRunAddSchema>>(),
)
?.let {
Body(runsAnnotationQueueRunAddSchemaArray = it, _json = json)
},
?.let { Body(annotationQueueRunAddSchemas = it, _json = json) },
)
.filterNotNull()
.allMaxBy { it.validity() }
@@ -464,12 +512,242 @@ private constructor(
value.runsUuidArray != null -> generator.writeObject(value.runsUuidArray)
value.runsAnnotationQueueRunAddSchemaArray != null ->
generator.writeObject(value.runsAnnotationQueueRunAddSchemaArray)
value.annotationQueueRunAddSchemas != null ->
generator.writeObject(value.annotationQueueRunAddSchemas)
value._json != null -> generator.writeObject(value._json)
else -> throw IllegalStateException("Invalid Body")
}
}
}
/**
* Add a single run to AQ (CH path) with an optional back-pointer to the issues-agent
* proposal that seeded this add. Use when bulk-adding runs that come from different
* proposals — each row carries its own source_proposed_example_id. For unrelated bulk adds,
* prefer plain List[UUID] on the same endpoint.
*/
class AddRunToQueueRequest
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val runId: JsonField<String>,
private val sourceProposedExampleId: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@JsonCreator
private constructor(
@JsonProperty("run_id") @ExcludeMissing runId: JsonField<String> = JsonMissing.of(),
@JsonProperty("source_proposed_example_id")
@ExcludeMissing
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
) : this(runId, sourceProposedExampleId, mutableMapOf())
/**
* @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 runId(): String = runId.getRequired("run_id")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
* if the server responded with an unexpected value).
*/
fun sourceProposedExampleId(): Optional<String> =
sourceProposedExampleId.getOptional("source_proposed_example_id")
/**
* Returns the raw JSON value of [runId].
*
* Unlike [runId], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("run_id") @ExcludeMissing fun _runId(): JsonField<String> = runId
/**
* Returns the raw JSON value of [sourceProposedExampleId].
*
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("source_proposed_example_id")
@ExcludeMissing
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
}
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> =
Collections.unmodifiableMap(additionalProperties)
fun toBuilder() = Builder().from(this)
companion object {
/**
* Returns a mutable builder for constructing an instance of [AddRunToQueueRequest].
*
* The following fields are required:
* ```java
* .runId()
* ```
*/
@JvmStatic fun builder() = Builder()
}
/** A builder for [AddRunToQueueRequest]. */
class Builder internal constructor() {
private var runId: JsonField<String>? = null
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
internal fun from(addRunToQueueRequest: AddRunToQueueRequest) = apply {
runId = addRunToQueueRequest.runId
sourceProposedExampleId = addRunToQueueRequest.sourceProposedExampleId
additionalProperties = addRunToQueueRequest.additionalProperties.toMutableMap()
}
fun runId(runId: String) = runId(JsonField.of(runId))
/**
* Sets [Builder.runId] to an arbitrary JSON value.
*
* You should usually call [Builder.runId] with a well-typed [String] value instead.
* This method is primarily for setting the field to an undocumented or not yet
* supported value.
*/
fun runId(runId: JsonField<String>) = apply { this.runId = runId }
fun sourceProposedExampleId(sourceProposedExampleId: String?) =
sourceProposedExampleId(JsonField.ofNullable(sourceProposedExampleId))
/**
* Alias for calling [Builder.sourceProposedExampleId] with
* `sourceProposedExampleId.orElse(null)`.
*/
fun sourceProposedExampleId(sourceProposedExampleId: Optional<String>) =
sourceProposedExampleId(sourceProposedExampleId.getOrNull())
/**
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
*
* You should usually call [Builder.sourceProposedExampleId] with a well-typed
* [String] value instead. This method is primarily for setting the field to an
* undocumented or not yet supported value.
*/
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
this.sourceProposedExampleId = sourceProposedExampleId
}
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 [AddRunToQueueRequest].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .runId()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AddRunToQueueRequest =
AddRunToQueueRequest(
checkRequired("runId", runId),
sourceProposedExampleId,
additionalProperties.toMutableMap(),
)
}
private var validated: Boolean = false
/**
* Validates that the types of all values in this object match their expected types
* recursively.
*
* This method is _not_ forwards compatible with new types from the API for existing
* fields.
*
* @throws LangChainInvalidDataException if any value type in this object doesn't match
* its expected type.
*/
fun validate(): AddRunToQueueRequest = apply {
if (validated) {
return@apply
}
runId()
sourceProposedExampleId()
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 =
(if (runId.asKnown().isPresent) 1 else 0) +
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is AddRunToQueueRequest &&
runId == other.runId &&
sourceProposedExampleId == other.sourceProposedExampleId &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
Objects.hash(runId, sourceProposedExampleId, additionalProperties)
}
override fun hashCode(): Int = hashCode
override fun toString() =
"AddRunToQueueRequest{runId=$runId, sourceProposedExampleId=$sourceProposedExampleId, additionalProperties=$additionalProperties}"
}
/** Deprecated: use plain UUID list or AddRunToQueueByKeyRequest instead. */
class AnnotationQueueRunAddSchema
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -26,6 +26,7 @@ private constructor(
private val runId: JsonField<String>,
private val addedAt: JsonField<OffsetDateTime>,
private val lastReviewedTime: JsonField<OffsetDateTime>,
private val sourceProposedExampleId: JsonField<String>,
private val additionalProperties: MutableMap<String, JsonValue>,
) {
@@ -40,7 +41,10 @@ private constructor(
@JsonProperty("last_reviewed_time")
@ExcludeMissing
lastReviewedTime: JsonField<OffsetDateTime> = JsonMissing.of(),
) : this(id, queueId, runId, addedAt, lastReviewedTime, mutableMapOf())
@JsonProperty("source_proposed_example_id")
@ExcludeMissing
sourceProposedExampleId: JsonField<String> = JsonMissing.of(),
) : this(id, queueId, runId, addedAt, lastReviewedTime, sourceProposedExampleId, mutableMapOf())
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -73,6 +77,13 @@ private constructor(
fun lastReviewedTime(): Optional<OffsetDateTime> =
lastReviewedTime.getOptional("last_reviewed_time")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun sourceProposedExampleId(): Optional<String> =
sourceProposedExampleId.getOptional("source_proposed_example_id")
/**
* Returns the raw JSON value of [id].
*
@@ -111,6 +122,16 @@ private constructor(
@ExcludeMissing
fun _lastReviewedTime(): JsonField<OffsetDateTime> = lastReviewedTime
/**
* Returns the raw JSON value of [sourceProposedExampleId].
*
* Unlike [sourceProposedExampleId], this method doesn't throw if the JSON field has an
* unexpected type.
*/
@JsonProperty("source_proposed_example_id")
@ExcludeMissing
fun _sourceProposedExampleId(): JsonField<String> = sourceProposedExampleId
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -146,6 +167,7 @@ private constructor(
private var runId: JsonField<String>? = null
private var addedAt: JsonField<OffsetDateTime> = JsonMissing.of()
private var lastReviewedTime: JsonField<OffsetDateTime> = JsonMissing.of()
private var sourceProposedExampleId: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@JvmSynthetic
@@ -155,6 +177,7 @@ private constructor(
runId = runCreateResponse.runId
addedAt = runCreateResponse.addedAt
lastReviewedTime = runCreateResponse.lastReviewedTime
sourceProposedExampleId = runCreateResponse.sourceProposedExampleId
additionalProperties = runCreateResponse.additionalProperties.toMutableMap()
}
@@ -217,6 +240,27 @@ private constructor(
this.lastReviewedTime = lastReviewedTime
}
fun sourceProposedExampleId(sourceProposedExampleId: String?) =
sourceProposedExampleId(JsonField.ofNullable(sourceProposedExampleId))
/**
* Alias for calling [Builder.sourceProposedExampleId] with
* `sourceProposedExampleId.orElse(null)`.
*/
fun sourceProposedExampleId(sourceProposedExampleId: Optional<String>) =
sourceProposedExampleId(sourceProposedExampleId.getOrNull())
/**
* Sets [Builder.sourceProposedExampleId] to an arbitrary JSON value.
*
* You should usually call [Builder.sourceProposedExampleId] with a well-typed [String]
* value instead. This method is primarily for setting the field to an undocumented or not
* yet supported value.
*/
fun sourceProposedExampleId(sourceProposedExampleId: JsonField<String>) = apply {
this.sourceProposedExampleId = sourceProposedExampleId
}
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -257,6 +301,7 @@ private constructor(
checkRequired("runId", runId),
addedAt,
lastReviewedTime,
sourceProposedExampleId,
additionalProperties.toMutableMap(),
)
}
@@ -281,6 +326,7 @@ private constructor(
runId()
addedAt()
lastReviewedTime()
sourceProposedExampleId()
validated = true
}
@@ -303,7 +349,8 @@ private constructor(
(if (queueId.asKnown().isPresent) 1 else 0) +
(if (runId.asKnown().isPresent) 1 else 0) +
(if (addedAt.asKnown().isPresent) 1 else 0) +
(if (lastReviewedTime.asKnown().isPresent) 1 else 0)
(if (lastReviewedTime.asKnown().isPresent) 1 else 0) +
(if (sourceProposedExampleId.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -316,15 +363,24 @@ private constructor(
runId == other.runId &&
addedAt == other.addedAt &&
lastReviewedTime == other.lastReviewedTime &&
sourceProposedExampleId == other.sourceProposedExampleId &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
Objects.hash(id, queueId, runId, addedAt, lastReviewedTime, additionalProperties)
Objects.hash(
id,
queueId,
runId,
addedAt,
lastReviewedTime,
sourceProposedExampleId,
additionalProperties,
)
}
override fun hashCode(): Int = hashCode
override fun toString() =
"RunCreateResponse{id=$id, queueId=$queueId, runId=$runId, addedAt=$addedAt, lastReviewedTime=$lastReviewedTime, additionalProperties=$additionalProperties}"
"RunCreateResponse{id=$id, queueId=$queueId, runId=$runId, addedAt=$addedAt, lastReviewedTime=$lastReviewedTime, sourceProposedExampleId=$sourceProposedExampleId, additionalProperties=$additionalProperties}"
}
@@ -123,6 +123,7 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sourceProposedExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.threadId("thread_id")
@@ -278,6 +279,8 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
)
assertThat(runSchemaWithAnnotationQueueInfo.shareToken())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo.sourceProposedExampleId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(runSchemaWithAnnotationQueueInfo.startTime())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(runSchemaWithAnnotationQueueInfo.tags().getOrNull()).containsExactly("string")
@@ -407,6 +410,7 @@ internal class RunSchemaWithAnnotationQueueInfoTest {
.build()
)
.shareToken("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.sourceProposedExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.startTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.addTag("string")
.threadId("thread_id")
@@ -19,6 +19,7 @@ internal class RunCreateResponseTest {
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.sourceProposedExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
assertThat(runCreateResponse.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
@@ -28,6 +29,8 @@ internal class RunCreateResponseTest {
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(runCreateResponse.lastReviewedTime())
.contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(runCreateResponse.sourceProposedExampleId())
.contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}
@Test
@@ -40,6 +43,7 @@ internal class RunCreateResponseTest {
.runId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.addedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.lastReviewedTime(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.sourceProposedExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
val roundtrippedRunCreateResponse =