diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b386befd..fac14074 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.19"
+ ".": "0.1.0-alpha.20"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index a98ceb5a..6e575fb3 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 100
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-624b469e0a8ed90f1574e609929702b6da43306d0681975f690ebda2d40a1c74.yml
-openapi_spec_hash: 389b1d06dd9a4b9e83d410d8d8ece950
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-52dde699e575bf9705b6b988184fe0ace65ece3774761187c3b3ec3b56d13eaa.yml
+openapi_spec_hash: f459963d082ead2284d818f11c8008fd
config_hash: 4c81a93850b2f9805605749a196ed2df
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 18b8ba55..2d561508 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,19 @@
# Changelog
+## 0.1.0-alpha.20 (2025-12-24)
+
+Full Changelog: [v0.1.0-alpha.19...v0.1.0-alpha.20](https://github.com/langchain-ai/langsmith-java/compare/v0.1.0-alpha.19...v0.1.0-alpha.20)
+
+### Features
+
+* **api:** api update ([4b197f0](https://github.com/langchain-ai/langsmith-java/commit/4b197f03e8a2d7658d2e268d854114398429f7a9))
+* **api:** api update ([5703f0f](https://github.com/langchain-ai/langsmith-java/commit/5703f0f838d16543a4c518dc108065d4e72e58b6))
+* **api:** api update ([e2e98b7](https://github.com/langchain-ai/langsmith-java/commit/e2e98b7e9ab23ea0298e79cfc38a49797db0e978))
+* **api:** api update ([96a6948](https://github.com/langchain-ai/langsmith-java/commit/96a69483bf3e39b21a65dfb1af1eea6914939dfa))
+* **api:** api update ([8895f35](https://github.com/langchain-ai/langsmith-java/commit/8895f3571aafdffce373dac1052a4f26fd38347d))
+* **api:** api update ([9c66288](https://github.com/langchain-ai/langsmith-java/commit/9c66288568aceb6d7b77b8742dc34e132c122b66))
+* **api:** api update ([f73c866](https://github.com/langchain-ai/langsmith-java/commit/f73c86620f221064be73d86d9ce540f4e8aeb5c6))
+
## 0.1.0-alpha.19 (2025-12-10)
Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/langchain-ai/langsmith-java/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)
diff --git a/README.md b/README.md
index 4e074db4..faa955c0 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
-[](https://central.sonatype.com/artifact/com.langchain.smith/langsmith-java/0.1.0-alpha.19)
-[](https://javadoc.io/doc/com.langchain.smith/langsmith-java/0.1.0-alpha.19)
+[](https://central.sonatype.com/artifact/com.langchain.smith/langsmith-java/0.1.0-alpha.20)
+[](https://javadoc.io/doc/com.langchain.smith/langsmith-java/0.1.0-alpha.20)
@@ -13,7 +13,7 @@ To learn more about LangSmith, check out the [docs](https://docs.smith.langchain
-The REST API documentation can be found on [docs.smith.langchain.com](https://docs.smith.langchain.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.langchain.smith/langsmith-java/0.1.0-alpha.19).
+The REST API documentation can be found on [docs.smith.langchain.com](https://docs.smith.langchain.com/). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.langchain.smith/langsmith-java/0.1.0-alpha.20).
@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.smith.langchain.com](https://do
### Gradle
```kotlin
-implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.19")
+implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.20")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.19")
com.langchain.smith
langsmith-java
- 0.1.0-alpha.19
+ 0.1.0-alpha.20
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 5e0d4d1c..c738d69d 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.langchain.smith"
- version = "0.1.0-alpha.19" // x-release-please-version
+ version = "0.1.0-alpha.20" // x-release-please-version
}
subprojects {
diff --git a/langsmith-java-client-okhttp/src/main/kotlin/com/langchain/smith/client/okhttp/OkHttpClient.kt b/langsmith-java-client-okhttp/src/main/kotlin/com/langchain/smith/client/okhttp/OkHttpClient.kt
index 68da8bb0..1b119a1a 100644
--- a/langsmith-java-client-okhttp/src/main/kotlin/com/langchain/smith/client/okhttp/OkHttpClient.kt
+++ b/langsmith-java-client-okhttp/src/main/kotlin/com/langchain/smith/client/okhttp/OkHttpClient.kt
@@ -93,9 +93,9 @@ private constructor(@JvmSynthetic internal val okHttpClient: okhttp3.OkHttpClien
clientBuilder.addNetworkInterceptor(
HttpLoggingInterceptor().setLevel(logLevel).apply {
redactHeader("X-API-Key")
- redactHeader("X-Tenant-Id")
- redactHeader("Authorization")
redactHeader("X-Organization-Id")
+ redactHeader("Authorization")
+ redactHeader("X-Tenant-Id")
}
)
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/ClientOptions.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/ClientOptions.kt
index c338351e..9b46c817 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/ClientOptions.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/ClientOptions.kt
@@ -507,9 +507,9 @@ private constructor(
headers.put("X-API-Key", it)
}
}
- tenantId?.let {
+ organizationId?.let {
if (!it.isEmpty()) {
- headers.put("X-Tenant-Id", it)
+ headers.put("X-Organization-Id", it)
}
}
bearerToken?.let {
@@ -517,9 +517,9 @@ private constructor(
headers.put("Authorization", "Bearer $it")
}
}
- organizationId?.let {
+ tenantId?.let {
if (!it.isEmpty()) {
- headers.put("X-Organization-Id", it)
+ headers.put("X-Tenant-Id", it)
}
}
headers.replaceAll(this.headers.build())
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 4937122f..4d1c6fe7 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
@@ -2,11 +2,34 @@
package com.langchain.smith.models.annotationqueues.runs
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.fasterxml.jackson.core.JsonGenerator
+import com.fasterxml.jackson.core.ObjectCodec
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.SerializerProvider
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize
+import com.fasterxml.jackson.databind.annotation.JsonSerialize
+import com.fasterxml.jackson.module.kotlin.jacksonTypeRef
+import com.langchain.smith.core.BaseDeserializer
+import com.langchain.smith.core.BaseSerializer
+import com.langchain.smith.core.Enum
+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.Params
+import com.langchain.smith.core.allMaxBy
import com.langchain.smith.core.checkRequired
+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.time.OffsetDateTime
+import java.util.Collections
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -15,14 +38,14 @@ import kotlin.jvm.optionals.getOrNull
class RunCreateParams
private constructor(
private val queueId: String?,
- private val body: List,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
fun queueId(): Optional = Optional.ofNullable(queueId)
- fun body(): List = body
+ fun body(): Body = body
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -49,14 +72,14 @@ private constructor(
class Builder internal constructor() {
private var queueId: String? = null
- private var body: MutableList? = null
+ private var body: Body? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@JvmSynthetic
internal fun from(runCreateParams: RunCreateParams) = apply {
queueId = runCreateParams.queueId
- body = runCreateParams.body.toMutableList()
+ body = runCreateParams.body
additionalHeaders = runCreateParams.additionalHeaders.toBuilder()
additionalQueryParams = runCreateParams.additionalQueryParams.toBuilder()
}
@@ -66,16 +89,18 @@ private constructor(
/** Alias for calling [Builder.queueId] with `queueId.orElse(null)`. */
fun queueId(queueId: Optional) = queueId(queueId.getOrNull())
- fun body(body: List) = apply { this.body = body.toMutableList() }
+ fun body(body: Body) = apply { this.body = body }
+
+ /** Alias for calling [body] with `Body.ofStrings(strings)`. */
+ fun bodyOfStrings(strings: List) = body(Body.ofStrings(strings))
/**
- * Adds a single [String] to [Builder.body].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
+ * Alias for calling [body] with
+ * `Body.ofAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas)`.
*/
- fun addBody(body: String) = apply {
- this.body = (this.body ?: mutableListOf()).apply { add(body) }
- }
+ fun bodyOfAnnotationQueueRunAddSchemas(
+ annotationQueueRunAddSchemas: List
+ ) = body(Body.ofAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas))
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
@@ -190,13 +215,13 @@ private constructor(
fun build(): RunCreateParams =
RunCreateParams(
queueId,
- checkRequired("body", body).toImmutable(),
+ checkRequired("body", body),
additionalHeaders.build(),
additionalQueryParams.build(),
)
}
- fun _body(): List = body
+ fun _body(): Body = body
fun _pathParam(index: Int): String =
when (index) {
@@ -208,6 +233,706 @@ private constructor(
override fun _queryParams(): QueryParams = additionalQueryParams
+ @JsonDeserialize(using = Body.Deserializer::class)
+ @JsonSerialize(using = Body.Serializer::class)
+ class Body
+ private constructor(
+ private val strings: List? = null,
+ private val annotationQueueRunAddSchemas: List? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ fun strings(): Optional> = Optional.ofNullable(strings)
+
+ fun annotationQueueRunAddSchemas(): Optional> =
+ Optional.ofNullable(annotationQueueRunAddSchemas)
+
+ fun isStrings(): Boolean = strings != null
+
+ fun isAnnotationQueueRunAddSchemas(): Boolean = annotationQueueRunAddSchemas != null
+
+ fun asStrings(): List = strings.getOrThrow("strings")
+
+ fun asAnnotationQueueRunAddSchemas(): List =
+ annotationQueueRunAddSchemas.getOrThrow("annotationQueueRunAddSchemas")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ strings != null -> visitor.visitStrings(strings)
+ annotationQueueRunAddSchemas != null ->
+ visitor.visitAnnotationQueueRunAddSchemas(annotationQueueRunAddSchemas)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitStrings(strings: List) {}
+
+ override fun visitAnnotationQueueRunAddSchemas(
+ annotationQueueRunAddSchemas: List
+ ) {
+ annotationQueueRunAddSchemas.forEach { it.validate() }
+ }
+ }
+ )
+ 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 =
+ accept(
+ object : Visitor {
+ override fun visitStrings(strings: List) = strings.size
+
+ override fun visitAnnotationQueueRunAddSchemas(
+ annotationQueueRunAddSchemas: List
+ ) = annotationQueueRunAddSchemas.sumOf { it.validity().toInt() }
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Body &&
+ strings == other.strings &&
+ annotationQueueRunAddSchemas == other.annotationQueueRunAddSchemas
+ }
+
+ override fun hashCode(): Int = Objects.hash(strings, annotationQueueRunAddSchemas)
+
+ override fun toString(): String =
+ when {
+ strings != null -> "Body{strings=$strings}"
+ annotationQueueRunAddSchemas != null ->
+ "Body{annotationQueueRunAddSchemas=$annotationQueueRunAddSchemas}"
+ _json != null -> "Body{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Body")
+ }
+
+ companion object {
+
+ @JvmStatic fun ofStrings(strings: List) = Body(strings = strings.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]. */
+ interface Visitor {
+
+ fun visitStrings(strings: List): T
+
+ fun visitAnnotationQueueRunAddSchemas(
+ annotationQueueRunAddSchemas: List
+ ): T
+
+ /**
+ * Maps an unknown variant of [Body] to a value of type [T].
+ *
+ * An instance of [Body] can contain an unknown variant if it was deserialized from data
+ * that doesn't match any known variant. For example, if the SDK is on an older version
+ * than the API, then the API may respond with new variants that the SDK is unaware of.
+ *
+ * @throws LangChainInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw LangChainInvalidDataException("Unknown Body: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Body::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Body {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef>())?.let {
+ Body(strings = it, _json = json)
+ },
+ tryDeserialize(
+ node,
+ jacksonTypeRef>(),
+ )
+ ?.let { Body(annotationQueueRunAddSchemas = 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 (e.g. deserializing from boolean).
+ 0 -> Body(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely
+ // valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Body::class) {
+
+ override fun serialize(
+ value: Body,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.strings != null -> generator.writeObject(value.strings)
+ value.annotationQueueRunAddSchemas != null ->
+ generator.writeObject(value.annotationQueueRunAddSchemas)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Body")
+ }
+ }
+ }
+
+ /** Schema for adding a run to an annotation queue with optional metadata. */
+ class AnnotationQueueRunAddSchema
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val runId: JsonField,
+ private val parentRunId: JsonField,
+ private val sessionId: JsonField,
+ private val startTime: JsonField,
+ private val traceId: JsonField,
+ private val traceTier: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("run_id") @ExcludeMissing runId: JsonField = JsonMissing.of(),
+ @JsonProperty("parent_run_id")
+ @ExcludeMissing
+ parentRunId: JsonField = JsonMissing.of(),
+ @JsonProperty("session_id")
+ @ExcludeMissing
+ sessionId: JsonField = JsonMissing.of(),
+ @JsonProperty("start_time")
+ @ExcludeMissing
+ startTime: JsonField = JsonMissing.of(),
+ @JsonProperty("trace_id")
+ @ExcludeMissing
+ traceId: JsonField = JsonMissing.of(),
+ @JsonProperty("trace_tier")
+ @ExcludeMissing
+ traceTier: JsonField = JsonMissing.of(),
+ ) : this(runId, parentRunId, sessionId, startTime, traceId, traceTier, 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 parentRunId(): Optional = parentRunId.getOptional("parent_run_id")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun sessionId(): Optional = sessionId.getOptional("session_id")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun startTime(): Optional = startTime.getOptional("start_time")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun traceId(): Optional = traceId.getOptional("trace_id")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g.
+ * if the server responded with an unexpected value).
+ */
+ fun traceTier(): Optional = traceTier.getOptional("trace_tier")
+
+ /**
+ * 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 [parentRunId].
+ *
+ * Unlike [parentRunId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("parent_run_id")
+ @ExcludeMissing
+ fun _parentRunId(): JsonField = parentRunId
+
+ /**
+ * Returns the raw JSON value of [sessionId].
+ *
+ * Unlike [sessionId], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("session_id")
+ @ExcludeMissing
+ fun _sessionId(): JsonField = sessionId
+
+ /**
+ * Returns the raw JSON value of [startTime].
+ *
+ * Unlike [startTime], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("start_time")
+ @ExcludeMissing
+ fun _startTime(): JsonField = startTime
+
+ /**
+ * Returns the raw JSON value of [traceId].
+ *
+ * Unlike [traceId], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("trace_id") @ExcludeMissing fun _traceId(): JsonField = traceId
+
+ /**
+ * Returns the raw JSON value of [traceTier].
+ *
+ * Unlike [traceTier], this method doesn't throw if the JSON field has an unexpected
+ * type.
+ */
+ @JsonProperty("trace_tier")
+ @ExcludeMissing
+ fun _traceTier(): JsonField = traceTier
+
+ @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
+ * [AnnotationQueueRunAddSchema].
+ *
+ * The following fields are required:
+ * ```java
+ * .runId()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [AnnotationQueueRunAddSchema]. */
+ class Builder internal constructor() {
+
+ private var runId: JsonField? = null
+ private var parentRunId: JsonField = JsonMissing.of()
+ private var sessionId: JsonField = JsonMissing.of()
+ private var startTime: JsonField = JsonMissing.of()
+ private var traceId: JsonField = JsonMissing.of()
+ private var traceTier: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(annotationQueueRunAddSchema: AnnotationQueueRunAddSchema) =
+ apply {
+ runId = annotationQueueRunAddSchema.runId
+ parentRunId = annotationQueueRunAddSchema.parentRunId
+ sessionId = annotationQueueRunAddSchema.sessionId
+ startTime = annotationQueueRunAddSchema.startTime
+ traceId = annotationQueueRunAddSchema.traceId
+ traceTier = annotationQueueRunAddSchema.traceTier
+ additionalProperties =
+ annotationQueueRunAddSchema.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 parentRunId(parentRunId: String?) =
+ parentRunId(JsonField.ofNullable(parentRunId))
+
+ /** Alias for calling [Builder.parentRunId] with `parentRunId.orElse(null)`. */
+ fun parentRunId(parentRunId: Optional) =
+ parentRunId(parentRunId.getOrNull())
+
+ /**
+ * Sets [Builder.parentRunId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.parentRunId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun parentRunId(parentRunId: JsonField) = apply {
+ this.parentRunId = parentRunId
+ }
+
+ fun sessionId(sessionId: String?) = sessionId(JsonField.ofNullable(sessionId))
+
+ /** Alias for calling [Builder.sessionId] with `sessionId.orElse(null)`. */
+ fun sessionId(sessionId: Optional) = sessionId(sessionId.getOrNull())
+
+ /**
+ * Sets [Builder.sessionId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.sessionId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun sessionId(sessionId: JsonField) = apply { this.sessionId = sessionId }
+
+ fun startTime(startTime: OffsetDateTime?) =
+ startTime(JsonField.ofNullable(startTime))
+
+ /** Alias for calling [Builder.startTime] with `startTime.orElse(null)`. */
+ fun startTime(startTime: Optional) =
+ startTime(startTime.getOrNull())
+
+ /**
+ * Sets [Builder.startTime] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.startTime] with a well-typed [OffsetDateTime]
+ * value instead. This method is primarily for setting the field to an undocumented
+ * or not yet supported value.
+ */
+ fun startTime(startTime: JsonField) = apply {
+ this.startTime = startTime
+ }
+
+ fun traceId(traceId: String?) = traceId(JsonField.ofNullable(traceId))
+
+ /** Alias for calling [Builder.traceId] with `traceId.orElse(null)`. */
+ fun traceId(traceId: Optional) = traceId(traceId.getOrNull())
+
+ /**
+ * Sets [Builder.traceId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.traceId] with a well-typed [String] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun traceId(traceId: JsonField) = apply { this.traceId = traceId }
+
+ fun traceTier(traceTier: TraceTier?) = traceTier(JsonField.ofNullable(traceTier))
+
+ /** Alias for calling [Builder.traceTier] with `traceTier.orElse(null)`. */
+ fun traceTier(traceTier: Optional) = traceTier(traceTier.getOrNull())
+
+ /**
+ * Sets [Builder.traceTier] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.traceTier] with a well-typed [TraceTier] value
+ * instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun traceTier(traceTier: JsonField) = apply {
+ this.traceTier = traceTier
+ }
+
+ 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 [AnnotationQueueRunAddSchema].
+ *
+ * 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(): AnnotationQueueRunAddSchema =
+ AnnotationQueueRunAddSchema(
+ checkRequired("runId", runId),
+ parentRunId,
+ sessionId,
+ startTime,
+ traceId,
+ traceTier,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): AnnotationQueueRunAddSchema = apply {
+ if (validated) {
+ return@apply
+ }
+
+ runId()
+ parentRunId()
+ sessionId()
+ startTime()
+ traceId()
+ traceTier().ifPresent { it.validate() }
+ 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 (parentRunId.asKnown().isPresent) 1 else 0) +
+ (if (sessionId.asKnown().isPresent) 1 else 0) +
+ (if (startTime.asKnown().isPresent) 1 else 0) +
+ (if (traceId.asKnown().isPresent) 1 else 0) +
+ (traceTier.asKnown().getOrNull()?.validity() ?: 0)
+
+ class TraceTier @JsonCreator private constructor(private val value: JsonField) :
+ Enum {
+
+ /**
+ * Returns this class instance's raw value.
+ *
+ * This is usually only useful if this instance was deserialized from data that
+ * doesn't match any known member, and you want to know that value. For example, if
+ * the SDK is on an older version than the API, then the API may respond with new
+ * members that the SDK is unaware of.
+ */
+ @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value
+
+ companion object {
+
+ @JvmField val LONGLIVED = of("longlived")
+
+ @JvmField val SHORTLIVED = of("shortlived")
+
+ @JvmStatic fun of(value: String) = TraceTier(JsonField.of(value))
+ }
+
+ /** An enum containing [TraceTier]'s known values. */
+ enum class Known {
+ LONGLIVED,
+ SHORTLIVED,
+ }
+
+ /**
+ * An enum containing [TraceTier]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [TraceTier] can contain an unknown value in a couple of cases:
+ * - It was deserialized from data that doesn't match any known member. For example,
+ * if the SDK is on an older version than the API, then the API may respond with
+ * new members that the SDK is unaware of.
+ * - It was constructed with an arbitrary value using the [of] method.
+ */
+ enum class Value {
+ LONGLIVED,
+ SHORTLIVED,
+ /**
+ * An enum member indicating that [TraceTier] was instantiated with an unknown
+ * value.
+ */
+ _UNKNOWN,
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value, or
+ * [Value._UNKNOWN] if the class was instantiated with an unknown value.
+ *
+ * Use the [known] method instead if you're certain the value is always known or if
+ * you want to throw for the unknown case.
+ */
+ fun value(): Value =
+ when (this) {
+ LONGLIVED -> Value.LONGLIVED
+ SHORTLIVED -> Value.SHORTLIVED
+ else -> Value._UNKNOWN
+ }
+
+ /**
+ * Returns an enum member corresponding to this class instance's value.
+ *
+ * Use the [value] method instead if you're uncertain the value is always known and
+ * don't want to throw for the unknown case.
+ *
+ * @throws LangChainInvalidDataException if this class instance's value is a not a
+ * known member.
+ */
+ fun known(): Known =
+ when (this) {
+ LONGLIVED -> Known.LONGLIVED
+ SHORTLIVED -> Known.SHORTLIVED
+ else -> throw LangChainInvalidDataException("Unknown TraceTier: $value")
+ }
+
+ /**
+ * Returns this class instance's primitive wire representation.
+ *
+ * This differs from the [toString] method because that method is primarily for
+ * debugging and generally doesn't throw.
+ *
+ * @throws LangChainInvalidDataException if this class instance's value does not
+ * have the expected primitive type.
+ */
+ fun asString(): String =
+ _value().asString().orElseThrow {
+ LangChainInvalidDataException("Value is not a String")
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): TraceTier = apply {
+ if (validated) {
+ return@apply
+ }
+
+ known()
+ 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 (value() == Value._UNKNOWN) 0 else 1
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is TraceTier && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is AnnotationQueueRunAddSchema &&
+ runId == other.runId &&
+ parentRunId == other.parentRunId &&
+ sessionId == other.sessionId &&
+ startTime == other.startTime &&
+ traceId == other.traceId &&
+ traceTier == other.traceTier &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ runId,
+ parentRunId,
+ sessionId,
+ startTime,
+ traceId,
+ traceTier,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "AnnotationQueueRunAddSchema{runId=$runId, parentRunId=$parentRunId, sessionId=$sessionId, startTime=$startTime, traceId=$traceId, traceTier=$traceTier, additionalProperties=$additionalProperties}"
+ }
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitListParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitListParams.kt
index fcb62b44..359db7a9 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitListParams.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitListParams.kt
@@ -14,12 +14,14 @@ import kotlin.jvm.optionals.getOrNull
/**
* Lists all commits for a repository with pagination support. This endpoint supports both
* authenticated and unauthenticated access. Authenticated users can access private repos, while
- * unauthenticated users can only access public repos.
+ * unauthenticated users can only access public repos. The include_stats parameter controls whether
+ * download and view statistics are computed (defaults to true).
*/
class CommitListParams
private constructor(
private val owner: JsonValue,
private val repo: JsonValue?,
+ private val includeStats: Boolean?,
private val limit: Long?,
private val offset: Long?,
private val additionalHeaders: Headers,
@@ -30,6 +32,9 @@ private constructor(
fun repo(): Optional = Optional.ofNullable(repo)
+ /** IncludeStats determines whether to compute num_downloads and num_views */
+ fun includeStats(): Optional = Optional.ofNullable(includeStats)
+
/** Limit is the pagination limit */
fun limit(): Optional = Optional.ofNullable(limit)
@@ -62,6 +67,7 @@ private constructor(
private var owner: JsonValue? = null
private var repo: JsonValue? = null
+ private var includeStats: Boolean? = null
private var limit: Long? = null
private var offset: Long? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
@@ -71,6 +77,7 @@ private constructor(
internal fun from(commitListParams: CommitListParams) = apply {
owner = commitListParams.owner
repo = commitListParams.repo
+ includeStats = commitListParams.includeStats
limit = commitListParams.limit
offset = commitListParams.offset
additionalHeaders = commitListParams.additionalHeaders.toBuilder()
@@ -84,6 +91,19 @@ private constructor(
/** Alias for calling [Builder.repo] with `repo.orElse(null)`. */
fun repo(repo: Optional) = repo(repo.getOrNull())
+ /** IncludeStats determines whether to compute num_downloads and num_views */
+ fun includeStats(includeStats: Boolean?) = apply { this.includeStats = includeStats }
+
+ /**
+ * Alias for [Builder.includeStats].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun includeStats(includeStats: Boolean) = includeStats(includeStats as Boolean?)
+
+ /** Alias for calling [Builder.includeStats] with `includeStats.orElse(null)`. */
+ fun includeStats(includeStats: Optional) = includeStats(includeStats.getOrNull())
+
/** Limit is the pagination limit */
fun limit(limit: Long?) = apply { this.limit = limit }
@@ -224,6 +244,7 @@ private constructor(
CommitListParams(
checkRequired("owner", owner),
repo,
+ includeStats,
limit,
offset,
additionalHeaders.build(),
@@ -243,6 +264,7 @@ private constructor(
override fun _queryParams(): QueryParams =
QueryParams.builder()
.apply {
+ includeStats?.let { put("include_stats", it.toString()) }
limit?.let { put("limit", it.toString()) }
offset?.let { put("offset", it.toString()) }
putAll(additionalQueryParams)
@@ -257,6 +279,7 @@ private constructor(
return other is CommitListParams &&
owner == other.owner &&
repo == other.repo &&
+ includeStats == other.includeStats &&
limit == other.limit &&
offset == other.offset &&
additionalHeaders == other.additionalHeaders &&
@@ -264,8 +287,16 @@ private constructor(
}
override fun hashCode(): Int =
- Objects.hash(owner, repo, limit, offset, additionalHeaders, additionalQueryParams)
+ Objects.hash(
+ owner,
+ repo,
+ includeStats,
+ limit,
+ offset,
+ additionalHeaders,
+ additionalQueryParams,
+ )
override fun toString() =
- "CommitListParams{owner=$owner, repo=$repo, limit=$limit, offset=$offset, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "CommitListParams{owner=$owner, repo=$repo, includeStats=$includeStats, limit=$limit, offset=$offset, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/DatasetCloneParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/DatasetCloneParams.kt
index 4d568d4a..55172304 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/DatasetCloneParams.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/DatasetCloneParams.kt
@@ -69,6 +69,12 @@ private constructor(
*/
fun examples(): Optional> = body.examples()
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun split(): Optional = body.split()
+
/**
* Returns the raw JSON value of [sourceDatasetId].
*
@@ -97,6 +103,13 @@ private constructor(
*/
fun _examples(): JsonField> = body._examples()
+ /**
+ * Returns the raw JSON value of [split].
+ *
+ * Unlike [split], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _split(): JsonField = body._split()
+
fun _additionalBodyProperties(): Map = body._additionalProperties()
/** Additional headers to send with the request. */
@@ -144,6 +157,8 @@ private constructor(
* - [targetDatasetId]
* - [asOf]
* - [examples]
+ * - [split]
+ * - etc.
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -218,6 +233,25 @@ private constructor(
*/
fun addExample(example: String) = apply { body.addExample(example) }
+ fun split(split: Split?) = apply { body.split(split) }
+
+ /** Alias for calling [Builder.split] with `split.orElse(null)`. */
+ fun split(split: Optional) = split(split.getOrNull())
+
+ /**
+ * Sets [Builder.split] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.split] with a well-typed [Split] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun split(split: JsonField) = apply { body.split(split) }
+
+ /** Alias for calling [split] with `Split.ofString(string)`. */
+ fun split(string: String) = apply { body.split(string) }
+
+ /** Alias for calling [split] with `Split.ofStrings(strings)`. */
+ fun splitOfStrings(strings: List) = apply { body.splitOfStrings(strings) }
+
fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
body.additionalProperties(additionalBodyProperties)
}
@@ -369,6 +403,7 @@ private constructor(
private val targetDatasetId: JsonField,
private val asOf: JsonField,
private val examples: JsonField>,
+ private val split: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -384,7 +419,8 @@ private constructor(
@JsonProperty("examples")
@ExcludeMissing
examples: JsonField> = JsonMissing.of(),
- ) : this(sourceDatasetId, targetDatasetId, asOf, examples, mutableMapOf())
+ @JsonProperty("split") @ExcludeMissing split: JsonField = JsonMissing.of(),
+ ) : this(sourceDatasetId, targetDatasetId, asOf, examples, split, mutableMapOf())
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -413,6 +449,12 @@ private constructor(
*/
fun examples(): Optional> = examples.getOptional("examples")
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun split(): Optional = split.getOptional("split")
+
/**
* Returns the raw JSON value of [sourceDatasetId].
*
@@ -449,6 +491,13 @@ private constructor(
@ExcludeMissing
fun _examples(): JsonField> = examples
+ /**
+ * Returns the raw JSON value of [split].
+ *
+ * Unlike [split], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("split") @ExcludeMissing fun _split(): JsonField = split
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -482,6 +531,7 @@ private constructor(
private var targetDatasetId: JsonField? = null
private var asOf: JsonField = JsonMissing.of()
private var examples: JsonField>? = null
+ private var split: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -490,6 +540,7 @@ private constructor(
targetDatasetId = body.targetDatasetId
asOf = body.asOf
examples = body.examples.map { it.toMutableList() }
+ split = body.split
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -570,6 +621,26 @@ private constructor(
}
}
+ fun split(split: Split?) = split(JsonField.ofNullable(split))
+
+ /** Alias for calling [Builder.split] with `split.orElse(null)`. */
+ fun split(split: Optional) = split(split.getOrNull())
+
+ /**
+ * Sets [Builder.split] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.split] with a well-typed [Split] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun split(split: JsonField) = apply { this.split = split }
+
+ /** Alias for calling [split] with `Split.ofString(string)`. */
+ fun split(string: String) = split(Split.ofString(string))
+
+ /** Alias for calling [split] with `Split.ofStrings(strings)`. */
+ fun splitOfStrings(strings: List) = split(Split.ofStrings(strings))
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -608,6 +679,7 @@ private constructor(
checkRequired("targetDatasetId", targetDatasetId),
asOf,
(examples ?: JsonMissing.of()).map { it.toImmutable() },
+ split,
additionalProperties.toMutableMap(),
)
}
@@ -623,6 +695,7 @@ private constructor(
targetDatasetId()
asOf().ifPresent { it.validate() }
examples()
+ split().ifPresent { it.validate() }
validated = true
}
@@ -645,7 +718,8 @@ private constructor(
(if (sourceDatasetId.asKnown().isPresent) 1 else 0) +
(if (targetDatasetId.asKnown().isPresent) 1 else 0) +
(asOf.asKnown().getOrNull()?.validity() ?: 0) +
- (examples.asKnown().getOrNull()?.size ?: 0)
+ (examples.asKnown().getOrNull()?.size ?: 0) +
+ (split.asKnown().getOrNull()?.validity() ?: 0)
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -657,17 +731,25 @@ private constructor(
targetDatasetId == other.targetDatasetId &&
asOf == other.asOf &&
examples == other.examples &&
+ split == other.split &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(sourceDatasetId, targetDatasetId, asOf, examples, additionalProperties)
+ Objects.hash(
+ sourceDatasetId,
+ targetDatasetId,
+ asOf,
+ examples,
+ split,
+ additionalProperties,
+ )
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{sourceDatasetId=$sourceDatasetId, targetDatasetId=$targetDatasetId, asOf=$asOf, examples=$examples, additionalProperties=$additionalProperties}"
+ "Body{sourceDatasetId=$sourceDatasetId, targetDatasetId=$targetDatasetId, asOf=$asOf, examples=$examples, split=$split, additionalProperties=$additionalProperties}"
}
/**
@@ -842,6 +924,173 @@ private constructor(
}
}
+ @JsonDeserialize(using = Split.Deserializer::class)
+ @JsonSerialize(using = Split.Serializer::class)
+ class Split
+ private constructor(
+ private val string: String? = null,
+ private val strings: List? = null,
+ private val _json: JsonValue? = null,
+ ) {
+
+ fun string(): Optional = Optional.ofNullable(string)
+
+ fun strings(): Optional> = Optional.ofNullable(strings)
+
+ fun isString(): Boolean = string != null
+
+ fun isStrings(): Boolean = strings != null
+
+ fun asString(): String = string.getOrThrow("string")
+
+ fun asStrings(): List = strings.getOrThrow("strings")
+
+ fun _json(): Optional = Optional.ofNullable(_json)
+
+ fun accept(visitor: Visitor): T =
+ when {
+ string != null -> visitor.visitString(string)
+ strings != null -> visitor.visitStrings(strings)
+ else -> visitor.unknown(_json)
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Split = apply {
+ if (validated) {
+ return@apply
+ }
+
+ accept(
+ object : Visitor {
+ override fun visitString(string: String) {}
+
+ override fun visitStrings(strings: List) {}
+ }
+ )
+ 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 =
+ accept(
+ object : Visitor {
+ override fun visitString(string: String) = 1
+
+ override fun visitStrings(strings: List) = strings.size
+
+ override fun unknown(json: JsonValue?) = 0
+ }
+ )
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Split && string == other.string && strings == other.strings
+ }
+
+ override fun hashCode(): Int = Objects.hash(string, strings)
+
+ override fun toString(): String =
+ when {
+ string != null -> "Split{string=$string}"
+ strings != null -> "Split{strings=$strings}"
+ _json != null -> "Split{_unknown=$_json}"
+ else -> throw IllegalStateException("Invalid Split")
+ }
+
+ companion object {
+
+ @JvmStatic fun ofString(string: String) = Split(string = string)
+
+ @JvmStatic fun ofStrings(strings: List) = Split(strings = strings.toImmutable())
+ }
+
+ /** An interface that defines how to map each variant of [Split] to a value of type [T]. */
+ interface Visitor {
+
+ fun visitString(string: String): T
+
+ fun visitStrings(strings: List): T
+
+ /**
+ * Maps an unknown variant of [Split] to a value of type [T].
+ *
+ * An instance of [Split] can contain an unknown variant if it was deserialized from
+ * data that doesn't match any known variant. For example, if the SDK is on an older
+ * version than the API, then the API may respond with new variants that the SDK is
+ * unaware of.
+ *
+ * @throws LangChainInvalidDataException in the default implementation.
+ */
+ fun unknown(json: JsonValue?): T {
+ throw LangChainInvalidDataException("Unknown Split: $json")
+ }
+ }
+
+ internal class Deserializer : BaseDeserializer(Split::class) {
+
+ override fun ObjectCodec.deserialize(node: JsonNode): Split {
+ val json = JsonValue.fromJsonNode(node)
+
+ val bestMatches =
+ sequenceOf(
+ tryDeserialize(node, jacksonTypeRef())?.let {
+ Split(string = it, _json = json)
+ },
+ tryDeserialize(node, jacksonTypeRef>())?.let {
+ Split(strings = 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 (e.g. deserializing from object).
+ 0 -> Split(_json = json)
+ 1 -> bestMatches.single()
+ // If there's more than one match with the highest validity, then use the first
+ // completely valid match, or simply the first match if none are completely
+ // valid.
+ else -> bestMatches.firstOrNull { it.isValid() } ?: bestMatches.first()
+ }
+ }
+ }
+
+ internal class Serializer : BaseSerializer(Split::class) {
+
+ override fun serialize(
+ value: Split,
+ generator: JsonGenerator,
+ provider: SerializerProvider,
+ ) {
+ when {
+ value.string != null -> generator.writeObject(value.string)
+ value.strings != null -> generator.writeObject(value.strings)
+ value._json != null -> generator.writeObject(value._json)
+ else -> throw IllegalStateException("Invalid Split")
+ }
+ }
+ }
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/QueryExampleSchemaWithRuns.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/QueryExampleSchemaWithRuns.kt
index 4e5cf8cf..bf151d24 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/QueryExampleSchemaWithRuns.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/QueryExampleSchemaWithRuns.kt
@@ -29,6 +29,7 @@ private constructor(
private val offset: JsonField,
private val preview: JsonField,
private val sortParams: JsonField,
+ private val stream: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -47,6 +48,7 @@ private constructor(
@JsonProperty("sort_params")
@ExcludeMissing
sortParams: JsonField = JsonMissing.of(),
+ @JsonProperty("stream") @ExcludeMissing stream: JsonField = JsonMissing.of(),
) : this(
sessionIds,
comparativeExperimentId,
@@ -55,6 +57,7 @@ private constructor(
offset,
preview,
sortParams,
+ stream,
mutableMapOf(),
)
@@ -102,6 +105,12 @@ private constructor(
fun sortParams(): Optional =
sortParams.getOptional("sort_params")
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun stream(): Optional = stream.getOptional("stream")
+
/**
* Returns the raw JSON value of [sessionIds].
*
@@ -158,6 +167,13 @@ private constructor(
@ExcludeMissing
fun _sortParams(): JsonField = sortParams
+ /**
+ * Returns the raw JSON value of [stream].
+ *
+ * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("stream") @ExcludeMissing fun _stream(): JsonField = stream
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -193,6 +209,7 @@ private constructor(
private var offset: JsonField = JsonMissing.of()
private var preview: JsonField = JsonMissing.of()
private var sortParams: JsonField = JsonMissing.of()
+ private var stream: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -204,6 +221,7 @@ private constructor(
offset = queryExampleSchemaWithRuns.offset
preview = queryExampleSchemaWithRuns.preview
sortParams = queryExampleSchemaWithRuns.sortParams
+ stream = queryExampleSchemaWithRuns.stream
additionalProperties = queryExampleSchemaWithRuns.additionalProperties.toMutableMap()
}
@@ -314,6 +332,16 @@ private constructor(
this.sortParams = sortParams
}
+ fun stream(stream: Boolean) = stream(JsonField.of(stream))
+
+ /**
+ * Sets [Builder.stream] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.stream] with a well-typed [Boolean] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun stream(stream: JsonField) = apply { this.stream = stream }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -354,6 +382,7 @@ private constructor(
offset,
preview,
sortParams,
+ stream,
additionalProperties.toMutableMap(),
)
}
@@ -372,6 +401,7 @@ private constructor(
offset()
preview()
sortParams().ifPresent { it.validate() }
+ stream()
validated = true
}
@@ -396,7 +426,8 @@ private constructor(
(if (limit.asKnown().isPresent) 1 else 0) +
(if (offset.asKnown().isPresent) 1 else 0) +
(if (preview.asKnown().isPresent) 1 else 0) +
- (sortParams.asKnown().getOrNull()?.validity() ?: 0)
+ (sortParams.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (stream.asKnown().isPresent) 1 else 0)
class Filters
@JsonCreator
@@ -510,6 +541,7 @@ private constructor(
offset == other.offset &&
preview == other.preview &&
sortParams == other.sortParams &&
+ stream == other.stream &&
additionalProperties == other.additionalProperties
}
@@ -522,6 +554,7 @@ private constructor(
offset,
preview,
sortParams,
+ stream,
additionalProperties,
)
}
@@ -529,5 +562,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "QueryExampleSchemaWithRuns{sessionIds=$sessionIds, comparativeExperimentId=$comparativeExperimentId, filters=$filters, limit=$limit, offset=$offset, preview=$preview, sortParams=$sortParams, additionalProperties=$additionalProperties}"
+ "QueryExampleSchemaWithRuns{sessionIds=$sessionIds, comparativeExperimentId=$comparativeExperimentId, filters=$filters, limit=$limit, offset=$offset, preview=$preview, sortParams=$sortParams, stream=$stream, additionalProperties=$additionalProperties}"
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/RunCreateParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/RunCreateParams.kt
index 84097062..0a845b4a 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/RunCreateParams.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/RunCreateParams.kt
@@ -2,11 +2,23 @@
package com.langchain.smith.models.datasets.runs
+import com.fasterxml.jackson.annotation.JsonAnyGetter
+import com.fasterxml.jackson.annotation.JsonAnySetter
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.fasterxml.jackson.annotation.JsonProperty
+import com.langchain.smith.core.Enum
+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.Params
+import com.langchain.smith.core.checkKnown
import com.langchain.smith.core.checkRequired
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
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -18,8 +30,8 @@ import kotlin.jvm.optionals.getOrNull
class RunCreateParams
private constructor(
private val datasetId: String?,
- private val format: String?,
- private val queryExampleSchemaWithRuns: QueryExampleSchemaWithRuns,
+ private val format: Format?,
+ private val body: Body,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -27,12 +39,114 @@ private constructor(
fun datasetId(): Optional = Optional.ofNullable(datasetId)
/** Response format, e.g., 'csv' */
- fun format(): Optional = Optional.ofNullable(format)
+ fun format(): Optional = Optional.ofNullable(format)
- fun queryExampleSchemaWithRuns(): QueryExampleSchemaWithRuns = queryExampleSchemaWithRuns
+ /**
+ * @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 sessionIds(): List = body.sessionIds()
- fun _additionalBodyProperties(): Map =
- queryExampleSchemaWithRuns._additionalProperties()
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun comparativeExperimentId(): Optional = body.comparativeExperimentId()
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun filters(): Optional = body.filters()
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun limit(): Optional = body.limit()
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun offset(): Optional = body.offset()
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun preview(): Optional = body.preview()
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun sortParams(): Optional = body.sortParams()
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun stream(): Optional = body.stream()
+
+ /**
+ * Returns the raw JSON value of [sessionIds].
+ *
+ * Unlike [sessionIds], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _sessionIds(): JsonField> = body._sessionIds()
+
+ /**
+ * Returns the raw JSON value of [comparativeExperimentId].
+ *
+ * Unlike [comparativeExperimentId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ fun _comparativeExperimentId(): JsonField = body._comparativeExperimentId()
+
+ /**
+ * Returns the raw JSON value of [filters].
+ *
+ * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _filters(): JsonField = body._filters()
+
+ /**
+ * Returns the raw JSON value of [limit].
+ *
+ * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _limit(): JsonField = body._limit()
+
+ /**
+ * Returns the raw JSON value of [offset].
+ *
+ * Unlike [offset], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _offset(): JsonField = body._offset()
+
+ /**
+ * Returns the raw JSON value of [preview].
+ *
+ * Unlike [preview], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _preview(): JsonField = body._preview()
+
+ /**
+ * Returns the raw JSON value of [sortParams].
+ *
+ * Unlike [sortParams], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _sortParams(): JsonField = body._sortParams()
+
+ /**
+ * Returns the raw JSON value of [stream].
+ *
+ * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ fun _stream(): JsonField = body._stream()
+
+ fun _additionalBodyProperties(): Map = body._additionalProperties()
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -49,7 +163,7 @@ private constructor(
*
* The following fields are required:
* ```java
- * .queryExampleSchemaWithRuns()
+ * .sessionIds()
* ```
*/
@JvmStatic fun builder() = Builder()
@@ -59,8 +173,8 @@ private constructor(
class Builder internal constructor() {
private var datasetId: String? = null
- private var format: String? = null
- private var queryExampleSchemaWithRuns: QueryExampleSchemaWithRuns? = null
+ private var format: Format? = null
+ private var body: Body.Builder = Body.builder()
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -68,7 +182,7 @@ private constructor(
internal fun from(runCreateParams: RunCreateParams) = apply {
datasetId = runCreateParams.datasetId
format = runCreateParams.format
- queryExampleSchemaWithRuns = runCreateParams.queryExampleSchemaWithRuns
+ body = runCreateParams.body.toBuilder()
additionalHeaders = runCreateParams.additionalHeaders.toBuilder()
additionalQueryParams = runCreateParams.additionalQueryParams.toBuilder()
}
@@ -79,16 +193,166 @@ private constructor(
fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull())
/** Response format, e.g., 'csv' */
- fun format(format: String?) = apply { this.format = format }
+ fun format(format: Format?) = apply { this.format = format }
/** Alias for calling [Builder.format] with `format.orElse(null)`. */
- fun format(format: Optional) = format(format.getOrNull())
+ fun format(format: Optional) = format(format.getOrNull())
+
+ /**
+ * Sets the entire request body.
+ *
+ * This is generally only useful if you are already constructing the body separately.
+ * Otherwise, it's more convenient to use the top-level setters instead:
+ * - [sessionIds]
+ * - [comparativeExperimentId]
+ * - [filters]
+ * - [limit]
+ * - [offset]
+ * - etc.
+ */
+ fun body(body: Body) = apply { this.body = body.toBuilder() }
+
+ fun sessionIds(sessionIds: List) = apply { body.sessionIds(sessionIds) }
+
+ /**
+ * Sets [Builder.sessionIds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.sessionIds] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun sessionIds(sessionIds: JsonField>) = apply { body.sessionIds(sessionIds) }
+
+ /**
+ * Adds a single [String] to [sessionIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addSessionId(sessionId: String) = apply { body.addSessionId(sessionId) }
+
+ fun comparativeExperimentId(comparativeExperimentId: String?) = apply {
+ body.comparativeExperimentId(comparativeExperimentId)
+ }
+
+ /**
+ * Alias for calling [Builder.comparativeExperimentId] with
+ * `comparativeExperimentId.orElse(null)`.
+ */
+ fun comparativeExperimentId(comparativeExperimentId: Optional) =
+ comparativeExperimentId(comparativeExperimentId.getOrNull())
+
+ /**
+ * Sets [Builder.comparativeExperimentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comparativeExperimentId] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun comparativeExperimentId(comparativeExperimentId: JsonField) = apply {
+ body.comparativeExperimentId(comparativeExperimentId)
+ }
+
+ fun filters(filters: Filters?) = apply { body.filters(filters) }
+
+ /** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
+ fun filters(filters: Optional) = filters(filters.getOrNull())
+
+ /**
+ * Sets [Builder.filters] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.filters] with a well-typed [Filters] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun filters(filters: JsonField) = apply { body.filters(filters) }
+
+ fun limit(limit: Long?) = apply { body.limit(limit) }
+
+ /**
+ * Alias for [Builder.limit].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun limit(limit: Long) = limit(limit as Long?)
+
+ /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */
+ fun limit(limit: Optional) = limit(limit.getOrNull())
+
+ /**
+ * Sets [Builder.limit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.limit] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun limit(limit: JsonField) = apply { body.limit(limit) }
+
+ fun offset(offset: Long) = apply { body.offset(offset) }
+
+ /**
+ * Sets [Builder.offset] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.offset] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun offset(offset: JsonField) = apply { body.offset(offset) }
+
+ fun preview(preview: Boolean) = apply { body.preview(preview) }
+
+ /**
+ * Sets [Builder.preview] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.preview] with a well-typed [Boolean] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun preview(preview: JsonField) = apply { body.preview(preview) }
+
+ fun sortParams(sortParams: SortParamsForRunsComparisonView?) = apply {
+ body.sortParams(sortParams)
+ }
+
+ /** Alias for calling [Builder.sortParams] with `sortParams.orElse(null)`. */
+ fun sortParams(sortParams: Optional) =
+ sortParams(sortParams.getOrNull())
+
+ /**
+ * Sets [Builder.sortParams] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.sortParams] with a well-typed
+ * [SortParamsForRunsComparisonView] value instead. This method is primarily for setting the
+ * field to an undocumented or not yet supported value.
+ */
+ fun sortParams(sortParams: JsonField) = apply {
+ body.sortParams(sortParams)
+ }
+
+ fun stream(stream: Boolean) = apply { body.stream(stream) }
+
+ /**
+ * Sets [Builder.stream] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.stream] with a well-typed [Boolean] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun stream(stream: JsonField) = apply { body.stream(stream) }
- fun queryExampleSchemaWithRuns(queryExampleSchemaWithRuns: QueryExampleSchemaWithRuns) =
+ fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
+ body.additionalProperties(additionalBodyProperties)
+ }
+
+ fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
+ body.putAdditionalProperty(key, value)
+ }
+
+ fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
apply {
- this.queryExampleSchemaWithRuns = queryExampleSchemaWithRuns
+ body.putAllAdditionalProperties(additionalBodyProperties)
}
+ fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) }
+
+ fun removeAllAdditionalBodyProperties(keys: Set) = apply {
+ body.removeAllAdditionalProperties(keys)
+ }
+
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
putAllAdditionalHeaders(additionalHeaders)
@@ -194,7 +458,7 @@ private constructor(
*
* The following fields are required:
* ```java
- * .queryExampleSchemaWithRuns()
+ * .sessionIds()
* ```
*
* @throws IllegalStateException if any required field is unset.
@@ -203,13 +467,13 @@ private constructor(
RunCreateParams(
datasetId,
format,
- checkRequired("queryExampleSchemaWithRuns", queryExampleSchemaWithRuns),
+ body.build(),
additionalHeaders.build(),
additionalQueryParams.build(),
)
}
- fun _body(): QueryExampleSchemaWithRuns = queryExampleSchemaWithRuns
+ fun _body(): Body = body
fun _pathParam(index: Int): String =
when (index) {
@@ -222,11 +486,702 @@ private constructor(
override fun _queryParams(): QueryParams =
QueryParams.builder()
.apply {
- format?.let { put("format", it) }
+ format?.let { put("format", it.toString()) }
putAll(additionalQueryParams)
}
.build()
+ /**
+ * Request DTO for querying examples with runs - used for API input.
+ *
+ * This is separate from the internal schema to cleanly handle optional limit values. When limit
+ * is None, the internal schema will apply appropriate defaults based on format and stream
+ * settings.
+ */
+ class Body
+ @JsonCreator(mode = JsonCreator.Mode.DISABLED)
+ private constructor(
+ private val sessionIds: JsonField>,
+ private val comparativeExperimentId: JsonField,
+ private val filters: JsonField,
+ private val limit: JsonField,
+ private val offset: JsonField,
+ private val preview: JsonField,
+ private val sortParams: JsonField,
+ private val stream: JsonField,
+ private val additionalProperties: MutableMap,
+ ) {
+
+ @JsonCreator
+ private constructor(
+ @JsonProperty("session_ids")
+ @ExcludeMissing
+ sessionIds: JsonField> = JsonMissing.of(),
+ @JsonProperty("comparative_experiment_id")
+ @ExcludeMissing
+ comparativeExperimentId: JsonField = JsonMissing.of(),
+ @JsonProperty("filters") @ExcludeMissing filters: JsonField = JsonMissing.of(),
+ @JsonProperty("limit") @ExcludeMissing limit: JsonField = JsonMissing.of(),
+ @JsonProperty("offset") @ExcludeMissing offset: JsonField = JsonMissing.of(),
+ @JsonProperty("preview") @ExcludeMissing preview: JsonField = JsonMissing.of(),
+ @JsonProperty("sort_params")
+ @ExcludeMissing
+ sortParams: JsonField = JsonMissing.of(),
+ @JsonProperty("stream") @ExcludeMissing stream: JsonField = JsonMissing.of(),
+ ) : this(
+ sessionIds,
+ comparativeExperimentId,
+ filters,
+ limit,
+ offset,
+ preview,
+ sortParams,
+ stream,
+ 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 sessionIds(): List = sessionIds.getRequired("session_ids")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun comparativeExperimentId(): Optional =
+ comparativeExperimentId.getOptional("comparative_experiment_id")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun filters(): Optional = filters.getOptional("filters")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun limit(): Optional = limit.getOptional("limit")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun offset(): Optional = offset.getOptional("offset")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun preview(): Optional = preview.getOptional("preview")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun sortParams(): Optional =
+ sortParams.getOptional("sort_params")
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun stream(): Optional = stream.getOptional("stream")
+
+ /**
+ * Returns the raw JSON value of [sessionIds].
+ *
+ * Unlike [sessionIds], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("session_ids")
+ @ExcludeMissing
+ fun _sessionIds(): JsonField> = sessionIds
+
+ /**
+ * Returns the raw JSON value of [comparativeExperimentId].
+ *
+ * Unlike [comparativeExperimentId], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("comparative_experiment_id")
+ @ExcludeMissing
+ fun _comparativeExperimentId(): JsonField = comparativeExperimentId
+
+ /**
+ * Returns the raw JSON value of [filters].
+ *
+ * Unlike [filters], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("filters") @ExcludeMissing fun _filters(): JsonField = filters
+
+ /**
+ * Returns the raw JSON value of [limit].
+ *
+ * Unlike [limit], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("limit") @ExcludeMissing fun _limit(): JsonField = limit
+
+ /**
+ * Returns the raw JSON value of [offset].
+ *
+ * Unlike [offset], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("offset") @ExcludeMissing fun _offset(): JsonField = offset
+
+ /**
+ * Returns the raw JSON value of [preview].
+ *
+ * Unlike [preview], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("preview") @ExcludeMissing fun _preview(): JsonField = preview
+
+ /**
+ * Returns the raw JSON value of [sortParams].
+ *
+ * Unlike [sortParams], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("sort_params")
+ @ExcludeMissing
+ fun _sortParams(): JsonField = sortParams
+
+ /**
+ * Returns the raw JSON value of [stream].
+ *
+ * Unlike [stream], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("stream") @ExcludeMissing fun _stream(): JsonField = stream
+
+ @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 [Body].
+ *
+ * The following fields are required:
+ * ```java
+ * .sessionIds()
+ * ```
+ */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Body]. */
+ class Builder internal constructor() {
+
+ private var sessionIds: JsonField>? = null
+ private var comparativeExperimentId: JsonField = JsonMissing.of()
+ private var filters: JsonField = JsonMissing.of()
+ private var limit: JsonField = JsonMissing.of()
+ private var offset: JsonField = JsonMissing.of()
+ private var preview: JsonField = JsonMissing.of()
+ private var sortParams: JsonField = JsonMissing.of()
+ private var stream: JsonField = JsonMissing.of()
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(body: Body) = apply {
+ sessionIds = body.sessionIds.map { it.toMutableList() }
+ comparativeExperimentId = body.comparativeExperimentId
+ filters = body.filters
+ limit = body.limit
+ offset = body.offset
+ preview = body.preview
+ sortParams = body.sortParams
+ stream = body.stream
+ additionalProperties = body.additionalProperties.toMutableMap()
+ }
+
+ fun sessionIds(sessionIds: List) = sessionIds(JsonField.of(sessionIds))
+
+ /**
+ * Sets [Builder.sessionIds] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.sessionIds] with a well-typed `List` value
+ * instead. This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun sessionIds(sessionIds: JsonField>) = apply {
+ this.sessionIds = sessionIds.map { it.toMutableList() }
+ }
+
+ /**
+ * Adds a single [String] to [sessionIds].
+ *
+ * @throws IllegalStateException if the field was previously set to a non-list.
+ */
+ fun addSessionId(sessionId: String) = apply {
+ sessionIds =
+ (sessionIds ?: JsonField.of(mutableListOf())).also {
+ checkKnown("sessionIds", it).add(sessionId)
+ }
+ }
+
+ fun comparativeExperimentId(comparativeExperimentId: String?) =
+ comparativeExperimentId(JsonField.ofNullable(comparativeExperimentId))
+
+ /**
+ * Alias for calling [Builder.comparativeExperimentId] with
+ * `comparativeExperimentId.orElse(null)`.
+ */
+ fun comparativeExperimentId(comparativeExperimentId: Optional) =
+ comparativeExperimentId(comparativeExperimentId.getOrNull())
+
+ /**
+ * Sets [Builder.comparativeExperimentId] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.comparativeExperimentId] with a well-typed [String]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun comparativeExperimentId(comparativeExperimentId: JsonField) = apply {
+ this.comparativeExperimentId = comparativeExperimentId
+ }
+
+ fun filters(filters: Filters?) = filters(JsonField.ofNullable(filters))
+
+ /** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
+ fun filters(filters: Optional) = filters(filters.getOrNull())
+
+ /**
+ * Sets [Builder.filters] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.filters] with a well-typed [Filters] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun filters(filters: JsonField) = apply { this.filters = filters }
+
+ fun limit(limit: Long?) = limit(JsonField.ofNullable(limit))
+
+ /**
+ * Alias for [Builder.limit].
+ *
+ * This unboxed primitive overload exists for backwards compatibility.
+ */
+ fun limit(limit: Long) = limit(limit as Long?)
+
+ /** Alias for calling [Builder.limit] with `limit.orElse(null)`. */
+ fun limit(limit: Optional) = limit(limit.getOrNull())
+
+ /**
+ * Sets [Builder.limit] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.limit] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun limit(limit: JsonField) = apply { this.limit = limit }
+
+ fun offset(offset: Long) = offset(JsonField.of(offset))
+
+ /**
+ * Sets [Builder.offset] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.offset] with a well-typed [Long] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun offset(offset: JsonField) = apply { this.offset = offset }
+
+ fun preview(preview: Boolean) = preview(JsonField.of(preview))
+
+ /**
+ * Sets [Builder.preview] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.preview] with a well-typed [Boolean] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun preview(preview: JsonField) = apply { this.preview = preview }
+
+ fun sortParams(sortParams: SortParamsForRunsComparisonView?) =
+ sortParams(JsonField.ofNullable(sortParams))
+
+ /** Alias for calling [Builder.sortParams] with `sortParams.orElse(null)`. */
+ fun sortParams(sortParams: Optional) =
+ sortParams(sortParams.getOrNull())
+
+ /**
+ * Sets [Builder.sortParams] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.sortParams] with a well-typed
+ * [SortParamsForRunsComparisonView] value instead. This method is primarily for setting
+ * the field to an undocumented or not yet supported value.
+ */
+ fun sortParams(sortParams: JsonField) = apply {
+ this.sortParams = sortParams
+ }
+
+ fun stream(stream: Boolean) = stream(JsonField.of(stream))
+
+ /**
+ * Sets [Builder.stream] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.stream] with a well-typed [Boolean] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet
+ * supported value.
+ */
+ fun stream(stream: JsonField) = apply { this.stream = stream }
+
+ 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 [Body].
+ *
+ * Further updates to this [Builder] will not mutate the returned instance.
+ *
+ * The following fields are required:
+ * ```java
+ * .sessionIds()
+ * ```
+ *
+ * @throws IllegalStateException if any required field is unset.
+ */
+ fun build(): Body =
+ Body(
+ checkRequired("sessionIds", sessionIds).map { it.toImmutable() },
+ comparativeExperimentId,
+ filters,
+ limit,
+ offset,
+ preview,
+ sortParams,
+ stream,
+ additionalProperties.toMutableMap(),
+ )
+ }
+
+ private var validated: Boolean = false
+
+ fun validate(): Body = apply {
+ if (validated) {
+ return@apply
+ }
+
+ sessionIds()
+ comparativeExperimentId()
+ filters().ifPresent { it.validate() }
+ limit()
+ offset()
+ preview()
+ sortParams().ifPresent { it.validate() }
+ stream()
+ 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 =
+ (sessionIds.asKnown().getOrNull()?.size ?: 0) +
+ (if (comparativeExperimentId.asKnown().isPresent) 1 else 0) +
+ (filters.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (limit.asKnown().isPresent) 1 else 0) +
+ (if (offset.asKnown().isPresent) 1 else 0) +
+ (if (preview.asKnown().isPresent) 1 else 0) +
+ (sortParams.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (stream.asKnown().isPresent) 1 else 0)
+
+ override fun equals(other: Any?): Boolean {
+ if (this === other) {
+ return true
+ }
+
+ return other is Body &&
+ sessionIds == other.sessionIds &&
+ comparativeExperimentId == other.comparativeExperimentId &&
+ filters == other.filters &&
+ limit == other.limit &&
+ offset == other.offset &&
+ preview == other.preview &&
+ sortParams == other.sortParams &&
+ stream == other.stream &&
+ additionalProperties == other.additionalProperties
+ }
+
+ private val hashCode: Int by lazy {
+ Objects.hash(
+ sessionIds,
+ comparativeExperimentId,
+ filters,
+ limit,
+ offset,
+ preview,
+ sortParams,
+ stream,
+ additionalProperties,
+ )
+ }
+
+ override fun hashCode(): Int = hashCode
+
+ override fun toString() =
+ "Body{sessionIds=$sessionIds, comparativeExperimentId=$comparativeExperimentId, filters=$filters, limit=$limit, offset=$offset, preview=$preview, sortParams=$sortParams, stream=$stream, additionalProperties=$additionalProperties}"
+ }
+
+ class Filters
+ @JsonCreator
+ private constructor(
+ @com.fasterxml.jackson.annotation.JsonValue
+ private val additionalProperties: Map
+ ) {
+
+ @JsonAnyGetter
+ @ExcludeMissing
+ fun _additionalProperties(): Map = additionalProperties
+
+ fun toBuilder() = Builder().from(this)
+
+ companion object {
+
+ /** Returns a mutable builder for constructing an instance of [Filters]. */
+ @JvmStatic fun builder() = Builder()
+ }
+
+ /** A builder for [Filters]. */
+ class Builder internal constructor() {
+
+ private var additionalProperties: MutableMap = mutableMapOf()
+
+ @JvmSynthetic
+ internal fun from(filters: Filters) = apply {
+ additionalProperties = filters.additionalProperties.toMutableMap()
+ }
+
+ 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