From b5a32009fc34eb5a04d70205c19bf973414d800f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 4 May 2026 19:15:12 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 4 +- .../RunSchemaWithAnnotationQueueInfo.kt | 52 ++- .../annotationqueues/runs/RunCreateParams.kt | 304 +++++++++++++++++- .../runs/RunCreateResponse.kt | 64 +++- .../RunSchemaWithAnnotationQueueInfoTest.kt | 4 + .../runs/RunCreateResponseTest.kt | 4 + 6 files changed, 412 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index b917870d..67f11be3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 122 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith/langsmith-api-153ff40199b6d21919c6b4c8a3f0150b35b3ef031f96f213cfad62fb18c7be71.yml -openapi_spec_hash: ee76d4c9785b7d502cb3f6610c6f5cfd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith/langsmith-api-c4d4f14ce65c86dc0604732a40257605b558fb6581d92426981a603818af1d52.yml +openapi_spec_hash: d65b4acd00c1eb81f0a74bffd2e80047 config_hash: 57e1c5d2f7d3f4c50121dda73a181670 diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfo.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfo.kt index 05b30e94..cc8992c1 100644 --- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfo.kt +++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfo.kt @@ -76,6 +76,7 @@ private constructor( private val s3Urls: JsonField, private val serialized: JsonField, private val shareToken: JsonField, + private val sourceProposedExampleId: JsonField, private val startTime: JsonField, private val tags: JsonField>, private val threadId: JsonField, @@ -218,6 +219,9 @@ private constructor( @JsonProperty("share_token") @ExcludeMissing shareToken: JsonField = JsonMissing.of(), + @JsonProperty("source_proposed_example_id") + @ExcludeMissing + sourceProposedExampleId: JsonField = JsonMissing.of(), @JsonProperty("start_time") @ExcludeMissing startTime: JsonField = JsonMissing.of(), @@ -294,6 +298,7 @@ private constructor( s3Urls, serialized, shareToken, + sourceProposedExampleId, startTime, tags, threadId, @@ -619,6 +624,13 @@ private constructor( */ fun shareToken(): Optional = 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 = + 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 = 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 = sourceProposedExampleId + /** * Returns the raw JSON value of [startTime]. * @@ -1283,6 +1305,7 @@ private constructor( private var s3Urls: JsonField = JsonMissing.of() private var serialized: JsonField = JsonMissing.of() private var shareToken: JsonField = JsonMissing.of() + private var sourceProposedExampleId: JsonField = JsonMissing.of() private var startTime: JsonField = JsonMissing.of() private var tags: JsonField>? = null private var threadId: JsonField = 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) = 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) = + 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) = 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}" } diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateParams.kt index 8b65d758..28b234ea 100644 --- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateParams.kt +++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateParams.kt @@ -100,9 +100,17 @@ private constructor( * `Body.ofRunsAnnotationQueueRunAddSchemaArray(runsAnnotationQueueRunAddSchemaArray)`. */ fun bodyOfRunsAnnotationQueueRunAddSchemaArray( - runsAnnotationQueueRunAddSchemaArray: List + runsAnnotationQueueRunAddSchemaArray: List ) = body(Body.ofRunsAnnotationQueueRunAddSchemaArray(runsAnnotationQueueRunAddSchemaArray)) + /** + * Alias for calling [body] with + * `Body.ofAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas)`. + */ + fun bodyOfAnnotationQueueRunAddSchemas( + annotationQueueRunAddSchemas: List + ) = 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? = null, - private val runsAnnotationQueueRunAddSchemaArray: List? = null, + private val runsAnnotationQueueRunAddSchemaArray: List? = null, + private val annotationQueueRunAddSchemas: List? = null, private val _json: JsonValue? = null, ) { fun runsUuidArray(): Optional> = Optional.ofNullable(runsUuidArray) - fun runsAnnotationQueueRunAddSchemaArray(): Optional> = + fun runsAnnotationQueueRunAddSchemaArray(): Optional> = Optional.ofNullable(runsAnnotationQueueRunAddSchemaArray) + fun annotationQueueRunAddSchemas(): Optional> = + Optional.ofNullable(annotationQueueRunAddSchemas) + fun isRunsUuidArray(): Boolean = runsUuidArray != null fun isRunsAnnotationQueueRunAddSchemaArray(): Boolean = runsAnnotationQueueRunAddSchemaArray != null + fun isAnnotationQueueRunAddSchemas(): Boolean = annotationQueueRunAddSchemas != null + fun asRunsUuidArray(): List = runsUuidArray.getOrThrow("runsUuidArray") - fun asRunsAnnotationQueueRunAddSchemaArray(): List = + fun asRunsAnnotationQueueRunAddSchemaArray(): List = runsAnnotationQueueRunAddSchemaArray.getOrThrow("runsAnnotationQueueRunAddSchemaArray") + fun asAnnotationQueueRunAddSchemas(): List = + annotationQueueRunAddSchemas.getOrThrow("annotationQueueRunAddSchemas") + fun _json(): Optional = 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) {} override fun visitRunsAnnotationQueueRunAddSchemaArray( - runsAnnotationQueueRunAddSchemaArray: List + runsAnnotationQueueRunAddSchemaArray: List ) { runsAnnotationQueueRunAddSchemaArray.forEach { it.validate() } } + + override fun visitAnnotationQueueRunAddSchemas( + annotationQueueRunAddSchemas: List + ) { + annotationQueueRunAddSchemas.forEach { it.validate() } + } } ) validated = true @@ -351,9 +376,13 @@ private constructor( runsUuidArray.size override fun visitRunsAnnotationQueueRunAddSchemaArray( - runsAnnotationQueueRunAddSchemaArray: List + runsAnnotationQueueRunAddSchemaArray: List ) = runsAnnotationQueueRunAddSchemaArray.sumOf { it.validity().toInt() } + override fun visitAnnotationQueueRunAddSchemas( + annotationQueueRunAddSchemas: List + ) = 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 + runsAnnotationQueueRunAddSchemaArray: List ) = Body( runsAnnotationQueueRunAddSchemaArray = runsAnnotationQueueRunAddSchemaArray.toImmutable() ) + + @JvmStatic + fun ofAnnotationQueueRunAddSchemas( + annotationQueueRunAddSchemas: List + ) = 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): T fun visitRunsAnnotationQueueRunAddSchemaArray( - runsAnnotationQueueRunAddSchemaArray: List + runsAnnotationQueueRunAddSchemaArray: List + ): T + + fun visitAnnotationQueueRunAddSchemas( + annotationQueueRunAddSchemas: List ): T /** @@ -429,13 +475,15 @@ private constructor( tryDeserialize(node, jacksonTypeRef>())?.let { Body(runsUuidArray = it, _json = json) }, + tryDeserialize(node, jacksonTypeRef>()) + ?.let { + Body(runsAnnotationQueueRunAddSchemaArray = it, _json = json) + }, tryDeserialize( node, jacksonTypeRef>(), ) - ?.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, + private val sourceProposedExampleId: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("run_id") @ExcludeMissing runId: JsonField = JsonMissing.of(), + @JsonProperty("source_proposed_example_id") + @ExcludeMissing + sourceProposedExampleId: JsonField = 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 = + 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 = 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 = sourceProposedExampleId + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [AddRunToQueueRequest]. + * + * The following fields are required: + * ```java + * .runId() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [AddRunToQueueRequest]. */ + class Builder internal constructor() { + + private var runId: JsonField? = null + private var sourceProposedExampleId: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = 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) = 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) = + 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) = apply { + this.sourceProposedExampleId = sourceProposedExampleId + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [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) diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponse.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponse.kt index 41a0c47b..3f685299 100644 --- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponse.kt +++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponse.kt @@ -26,6 +26,7 @@ private constructor( private val runId: JsonField, private val addedAt: JsonField, private val lastReviewedTime: JsonField, + private val sourceProposedExampleId: JsonField, private val additionalProperties: MutableMap, ) { @@ -40,7 +41,10 @@ private constructor( @JsonProperty("last_reviewed_time") @ExcludeMissing lastReviewedTime: JsonField = JsonMissing.of(), - ) : this(id, queueId, runId, addedAt, lastReviewedTime, mutableMapOf()) + @JsonProperty("source_proposed_example_id") + @ExcludeMissing + sourceProposedExampleId: JsonField = 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 = 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 = + sourceProposedExampleId.getOptional("source_proposed_example_id") + /** * Returns the raw JSON value of [id]. * @@ -111,6 +122,16 @@ private constructor( @ExcludeMissing fun _lastReviewedTime(): JsonField = 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 = sourceProposedExampleId + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -146,6 +167,7 @@ private constructor( private var runId: JsonField? = null private var addedAt: JsonField = JsonMissing.of() private var lastReviewedTime: JsonField = JsonMissing.of() + private var sourceProposedExampleId: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = 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) = + 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) = apply { + this.sourceProposedExampleId = sourceProposedExampleId + } + fun additionalProperties(additionalProperties: Map) = 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}" } diff --git a/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfoTest.kt b/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfoTest.kt index 2d839c2f..a61b467b 100644 --- a/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfoTest.kt +++ b/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/RunSchemaWithAnnotationQueueInfoTest.kt @@ -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") diff --git a/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponseTest.kt b/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponseTest.kt index 4b98ef9e..f612c820 100644 --- a/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponseTest.kt +++ b/langsmith-java-core/src/test/kotlin/com/langchain/smith/models/annotationqueues/runs/RunCreateResponseTest.kt @@ -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 =