diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index eb5355d37..fd1492e28 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,12 +1,14 @@
name: CI
on:
push:
- branches-ignore:
- - 'generated'
- - 'codegen/**'
- - 'integrated/**'
- - 'stl-preview-head/**'
- - 'stl-preview-base/**'
+ branches:
+ - '**'
+ - '!integrated/**'
+ - '!stl-preview-head/**'
+ - '!stl-preview-base/**'
+ - '!generated'
+ - '!codegen/**'
+ - 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
@@ -17,7 +19,7 @@ jobs:
timeout-minutes: 15
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/langsmith-api-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
@@ -44,7 +46,7 @@ jobs:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/langsmith-api-java' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
@@ -65,14 +67,18 @@ jobs:
run: ./scripts/build
- name: Get GitHub OIDC Token
- if: github.repository == 'stainless-sdks/langsmith-api-java'
+ if: |-
+ github.repository == 'stainless-sdks/langsmith-api-java' &&
+ !startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());
- name: Build and upload Maven artifacts
- if: github.repository == 'stainless-sdks/langsmith-api-java'
+ if: |-
+ github.repository == 'stainless-sdks/langsmith-api-java' &&
+ !startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
diff --git a/.github/workflows/count-methods.yml b/.github/workflows/count-methods.yml
deleted file mode 100644
index 1782d5aef..000000000
--- a/.github/workflows/count-methods.yml
+++ /dev/null
@@ -1,58 +0,0 @@
-name: Count number of methods in the SDK
-on:
- workflow_dispatch:
- push:
- pull_request:
- branches-ignore:
- - 'generated'
- - 'codegen/**'
- - 'integrated/**'
- - 'stl-preview-head/**'
- - 'stl-preview-base/**'
-
-jobs:
- count-methods:
- name: count methods
- runs-on: ubuntu-latest
- if: github.event_name == 'push' || github.event_name == 'pull_request'
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v6
-
- - name: Read method count from .stats.yml
- id: read_method_count
- run: |
- if [ ! -f .stats.yml ]; then
- echo "Error: .stats.yml file not found"
- exit 1
- fi
-
- METHOD_COUNT=$(grep -E '^configured_endpoints:\s*[0-9]+' .stats.yml | awk '{print $2}' || echo "")
-
- if [ -z "$METHOD_COUNT" ]; then
- echo "Error: Could not find configured_endpoints in .stats.yml"
- exit 1
- fi
-
- echo "Method count from .stats.yml: $METHOD_COUNT"
- echo "method_count=$METHOD_COUNT" >> $GITHUB_OUTPUT
-
- - name: Fail if method count exceeds threshold
- uses: actions/github-script@v8
- with:
- script: |
- const methodCount = parseInt('${{ steps.read_method_count.outputs.method_count }}');
- const threshold = 100;
-
- if (methodCount > threshold) {
- core.setFailed(
- ` Method count check failed!\n` +
- ` Current method count: ${methodCount}\n` +
- ` Maximum allowed: ${threshold}\n` +
- ` Excess: ${methodCount - threshold} methods\n\n` +
- `This check ensures the SDK doesn't exceed the configured endpoint limit.`
- );
- } else {
- console.log(`Currently at ${methodCount} methods`);
- }
diff --git a/.gitignore b/.gitignore
index b1346e6d1..90b85e944 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.prism.log
+.stdy.log
.gradle
.idea
.kotlin
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 1c0bb8852..380b6f913 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.1.0-alpha.23"
+ ".": "0.1.0-alpha.24"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 3df379769..3503c6f83 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-9301fa88ebc17384444c65b726e0a222d018834fa33dedcc2d32f31f460337cb.yml
-openapi_spec_hash: 3e08d32477a470030a45ceb0f15aabf2
-config_hash: dbf6574c76c5c4ae18ffb6d212de7a7c
+configured_endpoints: 102
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-9b1a87757cd49a12277fb568ad9a86554c1b46ac115f0ca43fd19e8d8025286d.yml
+openapi_spec_hash: 76801a4fc381af1c3435db9504a2b382
+config_hash: 787a12876983a14bce67ed57899e4a94
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 26d640782..c0df92411 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,57 @@
# Changelog
+## 0.1.0-alpha.24 (2026-03-25)
+
+Full Changelog: [v0.1.0-alpha.23...v0.1.0-alpha.24](https://github.com/langchain-ai/langsmith-java/compare/v0.1.0-alpha.23...v0.1.0-alpha.24)
+
+### Features
+
+* **api:** api update ([8e94d9d](https://github.com/langchain-ai/langsmith-java/commit/8e94d9dc65dfacd3f238e88631623a1338edec2e))
+* **api:** api update ([3288052](https://github.com/langchain-ai/langsmith-java/commit/32880529fe17d465d20ee922894a9e1af3351edd))
+* **api:** api update ([a4e3e5c](https://github.com/langchain-ai/langsmith-java/commit/a4e3e5cb858e66a9409ac162f04660c514cc24df))
+* **api:** api update ([ff16250](https://github.com/langchain-ai/langsmith-java/commit/ff162506f81ad1616567c9119ded36c1a344c774))
+* **api:** api update ([ef7c7a7](https://github.com/langchain-ai/langsmith-java/commit/ef7c7a798786b073e403d994ee2a9367d4db59ee))
+* **api:** api update ([643c7b1](https://github.com/langchain-ai/langsmith-java/commit/643c7b121acd874a72c36e80fbd6d8d4aa772319))
+* **api:** api update ([4b9c97d](https://github.com/langchain-ai/langsmith-java/commit/4b9c97d873492f919885fc1e394d1819fbedd09a))
+* **api:** api update ([ea4e843](https://github.com/langchain-ai/langsmith-java/commit/ea4e843eea1709113fd259659c2cc85fd6317fa5))
+* **api:** api update ([74d2131](https://github.com/langchain-ai/langsmith-java/commit/74d213181b7a2398fa8852235de5a1123ff0a7fe))
+* **api:** api update ([2708533](https://github.com/langchain-ai/langsmith-java/commit/27085335b36f0ecb249a3bd079f96d8d9fad6c1f))
+* **api:** api update ([8f48677](https://github.com/langchain-ai/langsmith-java/commit/8f48677e5ca0dfd9c9e9bc248c204863f233542a))
+* **api:** api update ([c11821f](https://github.com/langchain-ai/langsmith-java/commit/c11821f56ba08939568332468a1e9376c78e6372))
+* **api:** api update ([44fe8b3](https://github.com/langchain-ai/langsmith-java/commit/44fe8b31986af7ae7ac489c0a59335afb8021f9f))
+* **api:** api update ([d11c759](https://github.com/langchain-ai/langsmith-java/commit/d11c759b1cf0d360f07aa0807f554c36f3262b14))
+* **api:** manual updates ([09f1302](https://github.com/langchain-ai/langsmith-java/commit/09f1302329d0fcd9082bc52b2381271aabd71bab))
+* **api:** manual updates ([dbed70a](https://github.com/langchain-ai/langsmith-java/commit/dbed70af760f0e807626650a2a7d6ecb8d30f0ad))
+* **api:** manual updates ([48e2ca2](https://github.com/langchain-ai/langsmith-java/commit/48e2ca294bd412398290777db3ef14655ed47b1c))
+* **api:** manual updates ([d8ac870](https://github.com/langchain-ai/langsmith-java/commit/d8ac87089db42004a53e880f419dcf6749c60817))
+* **api:** manual updates ([bdb35f0](https://github.com/langchain-ai/langsmith-java/commit/bdb35f01f6374860fe6fa3c83f6f102f22590b23))
+
+
+### Bug Fixes
+
+* **client:** allow updating header/query affecting fields in `toBuilder()` ([5069881](https://github.com/langchain-ai/langsmith-java/commit/5069881aebcffc8ea2058de667a7af33efc15ec3))
+* **client:** incorrect `Retry-After` parsing ([b607264](https://github.com/langchain-ai/langsmith-java/commit/b607264e2c7e10374f5d79d922c6850208b6f839))
+* fix streaming in java sdk ([#95](https://github.com/langchain-ai/langsmith-java/issues/95)) ([76da93f](https://github.com/langchain-ai/langsmith-java/commit/76da93f2c0c3a0466feee196243a214e8642b303))
+
+
+### Chores
+
+* align user agent format ([#96](https://github.com/langchain-ai/langsmith-java/issues/96)) ([5cf06d6](https://github.com/langchain-ai/langsmith-java/commit/5cf06d612963f01b49d6f62117226d948e004046))
+* **ci:** skip lint on metadata-only changes ([4c1197c](https://github.com/langchain-ai/langsmith-java/commit/4c1197ce483f317defed85f81d3ec3f5053f68d3))
+* **ci:** skip uploading artifacts on stainless-internal branches ([c994122](https://github.com/langchain-ai/langsmith-java/commit/c994122d8c4eea78bb8a942b0ed1db58e6338e1e))
+* **deps:** bump the all-actions group with 5 updates ([#92](https://github.com/langchain-ai/langsmith-java/issues/92)) ([3a1a72f](https://github.com/langchain-ai/langsmith-java/commit/3a1a72f5595393a437a8ddf1acc69bb44529b0e8))
+* drop apache dependency ([75ca9d7](https://github.com/langchain-ai/langsmith-java/commit/75ca9d71b49bad02bdbd66141f693204b296a9ec))
+* **internal:** bump ktfmt ([d9a4a39](https://github.com/langchain-ai/langsmith-java/commit/d9a4a396ad92c9f33c5922dabc00a8ba2451199b))
+* **internal:** bump palantir-java-format ([576ebd2](https://github.com/langchain-ai/langsmith-java/commit/576ebd2a02613c632dd1e00ba9c606df99de8f37))
+* **internal:** codegen related update ([29d55b0](https://github.com/langchain-ai/langsmith-java/commit/29d55b0ee9f40c2d327f1c08a714ccd9cad1384b))
+* **internal:** expand imports ([4c7542f](https://github.com/langchain-ai/langsmith-java/commit/4c7542f4525b43d8fc2adcd7d084a080581b5c48))
+* **internal:** tweak CI branches ([b7cecc1](https://github.com/langchain-ai/langsmith-java/commit/b7cecc1caa774426df72acd5734a2c29a96a3e60))
+* **internal:** update gitignore ([d0df3fa](https://github.com/langchain-ai/langsmith-java/commit/d0df3fa13a923514d9d3c66d5d96b4fa1fea4a22))
+* **internal:** update retry delay tests ([a9c7999](https://github.com/langchain-ai/langsmith-java/commit/a9c7999f55bc12c2d1bac268ce3a2ca5bbd58dc5))
+* make `Properties` more resilient to `null` ([47c70f9](https://github.com/langchain-ai/langsmith-java/commit/47c70f91d5ec941fafc08a81baabf946602076c9))
+* remove old test ([#97](https://github.com/langchain-ai/langsmith-java/issues/97)) ([79d708b](https://github.com/langchain-ai/langsmith-java/commit/79d708b935ba234c50d10980a7fef8ad12c58f61))
+* update placeholder string ([be1baa7](https://github.com/langchain-ai/langsmith-java/commit/be1baa704ad8ebe899fbf8e4003f706fbc3d3f73))
+
## 0.1.0-alpha.23 (2026-02-20)
Full Changelog: [v0.1.0-alpha.22...v0.1.0-alpha.23](https://github.com/langchain-ai/langsmith-java/compare/v0.1.0-alpha.22...v0.1.0-alpha.23)
diff --git a/README.md b/README.md
index 955bc4b0f..27a9835c8 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.23)
-[](https://javadoc.io/doc/com.langchain.smith/langsmith-java/0.1.0-alpha.23)
+[](https://central.sonatype.com/artifact/com.langchain.smith/langsmith-java/0.1.0-alpha.24)
+[](https://javadoc.io/doc/com.langchain.smith/langsmith-java/0.1.0-alpha.24)
@@ -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.23).
+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.24).
@@ -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.23")
+implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.24")
```
### Maven
@@ -33,7 +33,7 @@ implementation("com.langchain.smith:langsmith-java:0.1.0-alpha.23")
com.langchain.smith
langsmith-java
- 0.1.0-alpha.23
+ 0.1.0-alpha.24
```
diff --git a/build.gradle.kts b/build.gradle.kts
index 579c36df4..4c1f4f2c0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,7 +8,7 @@ repositories {
allprojects {
group = "com.langchain.smith"
- version = "0.1.0-alpha.23" // x-release-please-version
+ version = "0.1.0-alpha.24" // x-release-please-version
}
subprojects {
diff --git a/buildSrc/src/main/kotlin/langchain.java.gradle.kts b/buildSrc/src/main/kotlin/langchain.java.gradle.kts
index c18dbd1dc..52c35bb55 100644
--- a/buildSrc/src/main/kotlin/langchain.java.gradle.kts
+++ b/buildSrc/src/main/kotlin/langchain.java.gradle.kts
@@ -46,7 +46,7 @@ tasks.withType().configureEach {
val palantir by configurations.creating
dependencies {
- palantir("com.palantir.javaformat:palantir-java-format:2.73.0")
+ palantir("com.palantir.javaformat:palantir-java-format:2.89.0")
}
fun registerPalantir(
diff --git a/buildSrc/src/main/kotlin/langchain.kotlin.gradle.kts b/buildSrc/src/main/kotlin/langchain.kotlin.gradle.kts
index b4b787ba9..2632d2095 100644
--- a/buildSrc/src/main/kotlin/langchain.kotlin.gradle.kts
+++ b/buildSrc/src/main/kotlin/langchain.kotlin.gradle.kts
@@ -39,7 +39,7 @@ tasks.withType().configureEach {
val ktfmt by configurations.creating
dependencies {
- ktfmt("com.facebook:ktfmt:0.56")
+ ktfmt("com.facebook:ktfmt:0.61")
}
fun registerKtfmt(
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientAsyncImpl.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientAsyncImpl.kt
index 6cdb5155b..1e186df33 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientAsyncImpl.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientAsyncImpl.kt
@@ -33,7 +33,7 @@ class LangsmithClientAsyncImpl(private val clientOptions: ClientOptions) : Langs
else
clientOptions
.toBuilder()
- .putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}")
+ .putHeader("User-Agent", "langsmith-java/${getPackageVersion()}")
.build()
// Pass the original clientOptions so that this client sets its own User-Agent.
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientImpl.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientImpl.kt
index 377984fa0..ba499902a 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientImpl.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/client/LangsmithClientImpl.kt
@@ -33,7 +33,7 @@ class LangsmithClientImpl(private val clientOptions: ClientOptions) : LangsmithC
else
clientOptions
.toBuilder()
- .putHeader("User-Agent", "${javaClass.simpleName}/Java ${getPackageVersion()}")
+ .putHeader("User-Agent", "langsmith-java/${getPackageVersion()}")
.build()
// Pass the original clientOptions so that this client sets its own User-Agent.
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 c0ae8dc9b..5375f5baf 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
@@ -503,28 +503,29 @@ private constructor(
headers.put("X-Stainless-Runtime", "JRE")
headers.put("X-Stainless-Runtime-Version", getJavaVersion())
headers.put("X-Stainless-Kotlin-Version", KotlinVersion.CURRENT.toString())
+ // We replace after all the default headers to allow end-users to overwrite them.
+ headers.replaceAll(this.headers.build())
+ queryParams.replaceAll(this.queryParams.build())
apiKey?.let {
if (!it.isEmpty()) {
- headers.put("X-API-Key", it)
+ headers.replace("X-API-Key", it)
}
}
organizationId?.let {
if (!it.isEmpty()) {
- headers.put("X-Organization-Id", it)
+ headers.replace("X-Organization-Id", it)
}
}
bearerToken?.let {
if (!it.isEmpty()) {
- headers.put("Authorization", "Bearer $it")
+ headers.replace("Authorization", "Bearer $it")
}
}
tenantId?.let {
if (!it.isEmpty()) {
- headers.put("X-Tenant-Id", it)
+ headers.replace("X-Tenant-Id", it)
}
}
- headers.replaceAll(this.headers.build())
- queryParams.replaceAll(this.queryParams.build())
return ClientOptions(
httpClient,
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/Properties.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/Properties.kt
index 490782e48..c18124cfb 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/Properties.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/Properties.kt
@@ -34,9 +34,9 @@ fun getOsName(): String {
}
}
-fun getOsVersion(): String = System.getProperty("os.version", "unknown")
+fun getOsVersion(): String = System.getProperty("os.version", "unknown") ?: "unknown"
fun getPackageVersion(): String =
- LangsmithClient::class.java.`package`.implementationVersion ?: "unknown"
+ LangsmithClient::class.java.`package`?.implementationVersion ?: "unknown"
-fun getJavaVersion(): String = System.getProperty("java.version", "unknown")
+fun getJavaVersion(): String = System.getProperty("java.version", "unknown") ?: "unknown"
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/HttpRequestBodies.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/HttpRequestBodies.kt
index a28f37ba9..a94a4d8fb 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/HttpRequestBodies.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/HttpRequestBodies.kt
@@ -8,13 +8,13 @@ import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.json.JsonMapper
import com.fasterxml.jackson.databind.node.JsonNodeType
import com.langchain.smith.core.MultipartField
+import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
+import java.io.ByteArrayInputStream
import java.io.InputStream
import java.io.OutputStream
+import java.util.UUID
import kotlin.jvm.optionals.getOrNull
-import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder
-import org.apache.hc.core5.http.ContentType
-import org.apache.hc.core5.http.HttpEntity
@JvmSynthetic
internal inline fun json(jsonMapper: JsonMapper, value: T): HttpRequestBody =
@@ -37,94 +37,231 @@ internal fun multipartFormData(
jsonMapper: JsonMapper,
fields: Map>,
): HttpRequestBody =
- object : HttpRequestBody {
- private val entity: HttpEntity by lazy {
- MultipartEntityBuilder.create()
- .apply {
- fields.forEach { (name, field) ->
- val knownValue = field.value.asKnown().getOrNull()
- val parts =
- if (knownValue is InputStream) {
- // Read directly from the `InputStream` instead of reading it all
- // into memory due to the `jsonMapper` serialization below.
- sequenceOf(name to knownValue)
- } else {
- val node = jsonMapper.valueToTree(field.value)
- serializePart(name, node)
+ MultipartBody.Builder()
+ .apply {
+ fields.forEach { (name, field) ->
+ val knownValue = field.value.asKnown().getOrNull()
+ val parts =
+ if (knownValue is InputStream) {
+ // Read directly from the `InputStream` instead of reading it all
+ // into memory due to the `jsonMapper` serialization below.
+ sequenceOf(name to knownValue)
+ } else {
+ val node = jsonMapper.valueToTree(field.value)
+ serializePart(name, node)
+ }
+
+ parts.forEach { (name, bytes) ->
+ val partBody =
+ if (bytes is ByteArrayInputStream) {
+ val byteArray = bytes.readBytes()
+
+ object : HttpRequestBody {
+
+ override fun writeTo(outputStream: OutputStream) {
+ outputStream.write(byteArray)
+ }
+
+ override fun contentType(): String = field.contentType
+
+ override fun contentLength(): Long = byteArray.size.toLong()
+
+ override fun repeatable(): Boolean = true
+
+ override fun close() {}
}
+ } else {
+ object : HttpRequestBody {
+
+ override fun writeTo(outputStream: OutputStream) {
+ bytes.copyTo(outputStream)
+ }
+
+ override fun contentType(): String = field.contentType
+
+ override fun contentLength(): Long = -1L
- parts.forEach { (name, bytes) ->
- addBinaryBody(
- name,
- bytes,
- ContentType.parseLenient(field.contentType),
- field.filename().getOrNull(),
- )
+ override fun repeatable(): Boolean = false
+
+ override fun close() = bytes.close()
+ }
}
- }
+
+ addPart(
+ MultipartBody.Part.create(
+ name,
+ field.filename().getOrNull(),
+ field.contentType,
+ partBody,
+ )
+ )
}
- .build()
+ }
}
+ .build()
- private fun serializePart(
- name: String,
- node: JsonNode,
- ): Sequence> =
- when (node.nodeType) {
- JsonNodeType.MISSING,
- JsonNodeType.NULL -> emptySequence()
- JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream())
- JsonNodeType.STRING -> sequenceOf(name to node.textValue().inputStream())
- JsonNodeType.BOOLEAN ->
- sequenceOf(name to node.booleanValue().toString().inputStream())
- JsonNodeType.NUMBER ->
- sequenceOf(name to node.numberValue().toString().inputStream())
- JsonNodeType.ARRAY ->
- sequenceOf(
- name to
- node
- .elements()
- .asSequence()
- .mapNotNull { element ->
- when (element.nodeType) {
- JsonNodeType.MISSING,
- JsonNodeType.NULL -> null
- JsonNodeType.STRING -> node.textValue()
- JsonNodeType.BOOLEAN -> node.booleanValue().toString()
- JsonNodeType.NUMBER -> node.numberValue().toString()
- null,
- JsonNodeType.BINARY,
- JsonNodeType.ARRAY,
- JsonNodeType.OBJECT,
- JsonNodeType.POJO ->
- throw LangChainInvalidDataException(
- "Unexpected JsonNode type in array: ${node.nodeType}"
- )
- }
- }
- .joinToString(",")
- .inputStream()
- )
- JsonNodeType.OBJECT ->
- node.fields().asSequence().flatMap { (key, value) ->
- serializePart("$name[$key]", value)
- }
- JsonNodeType.POJO,
- null ->
- throw LangChainInvalidDataException(
- "Unexpected JsonNode type: ${node.nodeType}"
- )
+private fun serializePart(name: String, node: JsonNode): Sequence> =
+ when (node.nodeType) {
+ JsonNodeType.MISSING,
+ JsonNodeType.NULL -> emptySequence()
+ JsonNodeType.BINARY -> sequenceOf(name to node.binaryValue().inputStream())
+ JsonNodeType.STRING -> sequenceOf(name to node.textValue().byteInputStream())
+ JsonNodeType.BOOLEAN -> sequenceOf(name to node.booleanValue().toString().byteInputStream())
+ JsonNodeType.NUMBER -> sequenceOf(name to node.numberValue().toString().byteInputStream())
+ JsonNodeType.ARRAY ->
+ sequenceOf(
+ name to
+ node
+ .elements()
+ .asSequence()
+ .mapNotNull { element ->
+ when (element.nodeType) {
+ JsonNodeType.MISSING,
+ JsonNodeType.NULL -> null
+ JsonNodeType.STRING -> element.textValue()
+ JsonNodeType.BOOLEAN -> element.booleanValue().toString()
+ JsonNodeType.NUMBER -> element.numberValue().toString()
+ null,
+ JsonNodeType.BINARY,
+ JsonNodeType.ARRAY,
+ JsonNodeType.OBJECT,
+ JsonNodeType.POJO ->
+ throw LangChainInvalidDataException(
+ "Unexpected JsonNode type in array: ${element.nodeType}"
+ )
+ }
+ }
+ .joinToString(",")
+ .byteInputStream()
+ )
+ JsonNodeType.OBJECT ->
+ node.fields().asSequence().flatMap { (key, value) ->
+ serializePart("$name[$key]", value)
}
+ JsonNodeType.POJO,
+ null -> throw LangChainInvalidDataException("Unexpected JsonNode type: ${node.nodeType}")
+ }
- private fun String.inputStream(): InputStream = toByteArray().inputStream()
+private class MultipartBody
+private constructor(private val boundary: String, private val parts: List) : HttpRequestBody {
+ private val boundaryBytes: ByteArray = boundary.toByteArray()
+ private val contentType = "multipart/form-data; boundary=$boundary"
- override fun writeTo(outputStream: OutputStream) = entity.writeTo(outputStream)
+ // This must remain in sync with `contentLength`.
+ override fun writeTo(outputStream: OutputStream) {
+ parts.forEach { part ->
+ outputStream.write(DASHDASH)
+ outputStream.write(boundaryBytes)
+ outputStream.write(CRLF)
- override fun contentType(): String = entity.contentType
+ outputStream.write(CONTENT_DISPOSITION)
+ outputStream.write(part.contentDisposition.toByteArray())
+ outputStream.write(CRLF)
- override fun contentLength(): Long = entity.contentLength
+ outputStream.write(CONTENT_TYPE)
+ outputStream.write(part.contentType.toByteArray())
+ outputStream.write(CRLF)
- override fun repeatable(): Boolean = entity.isRepeatable
+ outputStream.write(CRLF)
+ part.body.writeTo(outputStream)
+ outputStream.write(CRLF)
+ }
- override fun close() = entity.close()
+ outputStream.write(DASHDASH)
+ outputStream.write(boundaryBytes)
+ outputStream.write(DASHDASH)
+ outputStream.write(CRLF)
+ }
+
+ override fun contentType(): String = contentType
+
+ // This must remain in sync with `writeTo`.
+ override fun contentLength(): Long {
+ var byteCount = 0L
+
+ parts.forEach { part ->
+ val contentLength = part.body.contentLength()
+ if (contentLength == -1L) {
+ return -1L
+ }
+
+ byteCount +=
+ DASHDASH.size +
+ boundaryBytes.size +
+ CRLF.size +
+ CONTENT_DISPOSITION.size +
+ part.contentDisposition.toByteArray().size +
+ CRLF.size +
+ CONTENT_TYPE.size +
+ part.contentType.toByteArray().size +
+ CRLF.size +
+ CRLF.size +
+ contentLength +
+ CRLF.size
+ }
+
+ byteCount += DASHDASH.size + boundaryBytes.size + DASHDASH.size + CRLF.size
+ return byteCount
+ }
+
+ override fun repeatable(): Boolean = parts.all { it.body.repeatable() }
+
+ override fun close() {
+ parts.forEach { it.body.close() }
+ }
+
+ class Builder {
+ private val boundary = UUID.randomUUID().toString()
+ private val parts: MutableList = mutableListOf()
+
+ fun addPart(part: Part) = apply { parts.add(part) }
+
+ fun build() = MultipartBody(boundary, parts.toImmutable())
+ }
+
+ class Part
+ private constructor(
+ val contentDisposition: String,
+ val contentType: String,
+ val body: HttpRequestBody,
+ ) {
+ companion object {
+ fun create(
+ name: String,
+ filename: String?,
+ contentType: String,
+ body: HttpRequestBody,
+ ): Part {
+ val disposition = buildString {
+ append("form-data; name=")
+ appendQuotedString(name)
+ if (filename != null) {
+ append("; filename=")
+ appendQuotedString(filename)
+ }
+ }
+ return Part(disposition, contentType, body)
+ }
+ }
+ }
+
+ companion object {
+ private val CRLF = byteArrayOf('\r'.code.toByte(), '\n'.code.toByte())
+ private val DASHDASH = byteArrayOf('-'.code.toByte(), '-'.code.toByte())
+ private val CONTENT_DISPOSITION = "Content-Disposition: ".toByteArray()
+ private val CONTENT_TYPE = "Content-Type: ".toByteArray()
+
+ private fun StringBuilder.appendQuotedString(key: String) {
+ append('"')
+ for (ch in key) {
+ when (ch) {
+ '\n' -> append("%0A")
+ '\r' -> append("%0D")
+ '"' -> append("%22")
+ else -> append(ch)
+ }
+ }
+ append('"')
+ }
}
+}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/RetryingHttpClient.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/RetryingHttpClient.kt
index ff292bb74..4eda48e78 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/RetryingHttpClient.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/core/http/RetryingHttpClient.kt
@@ -1,3 +1,5 @@
+// File generated from our OpenAPI spec by Stainless.
+
package com.langchain.smith.core.http
import com.langchain.smith.core.DefaultSleeper
@@ -199,7 +201,7 @@ private constructor(
?: headers.values("Retry-After").getOrNull(0)?.let { retryAfter ->
retryAfter.toFloatOrNull()?.times(TimeUnit.SECONDS.toNanos(1))
?: try {
- ChronoUnit.MILLIS.between(
+ ChronoUnit.NANOS.between(
OffsetDateTime.now(clock),
OffsetDateTime.parse(
retryAfter,
@@ -212,13 +214,8 @@ private constructor(
}
}
?.let { retryAfterNanos ->
- // If the API asks us to wait a certain amount of time (and it's a reasonable
- // amount), just
- // do what it says.
- val retryAfter = Duration.ofNanos(retryAfterNanos.toLong())
- if (retryAfter in Duration.ofNanos(0)..Duration.ofMinutes(1)) {
- return retryAfter
- }
+ // If the API asks us to wait a certain amount of time, do what it says.
+ return Duration.ofNanos(retryAfterNanos.toLong())
}
// Apply exponential backoff, but not more than the max.
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/BadRequestException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/BadRequestException.kt
index e7ce096f0..551a688f8 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/BadRequestException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/BadRequestException.kt
@@ -10,7 +10,7 @@ import kotlin.jvm.optionals.getOrNull
class BadRequestException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- LangChainServiceException("400: $body", cause) {
+ LangChainServiceException(formatMessage(400, body), cause) {
override fun statusCode(): Int = 400
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/InternalServerException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/InternalServerException.kt
index c7e239181..982ff78fb 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/InternalServerException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/InternalServerException.kt
@@ -14,7 +14,7 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
-) : LangChainServiceException("$statusCode: $body", cause) {
+) : LangChainServiceException(formatMessage(statusCode, body), cause) {
override fun statusCode(): Int = statusCode
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/LangChainServiceException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/LangChainServiceException.kt
index def4778b1..26d89bc9c 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/LangChainServiceException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/LangChainServiceException.kt
@@ -2,6 +2,7 @@
package com.langchain.smith.errors
+import com.fasterxml.jackson.databind.ObjectMapper
import com.langchain.smith.core.JsonValue
import com.langchain.smith.core.http.Headers
@@ -14,4 +15,19 @@ protected constructor(message: String, cause: Throwable? = null) :
abstract fun headers(): Headers
abstract fun body(): JsonValue
+
+ companion object {
+
+ /** Formats a status code and [JsonValue] error body into an error message. */
+ @JvmStatic
+ fun formatMessage(statusCode: Int, body: JsonValue): String {
+ val bodyStr =
+ try {
+ ObjectMapper().writeValueAsString(body)
+ } catch (_: Exception) {
+ body.toString()
+ }
+ return "$statusCode: $bodyStr"
+ }
+ }
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/NotFoundException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/NotFoundException.kt
index a070b703e..74c3b1e71 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/NotFoundException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/NotFoundException.kt
@@ -10,7 +10,7 @@ import kotlin.jvm.optionals.getOrNull
class NotFoundException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- LangChainServiceException("404: $body", cause) {
+ LangChainServiceException(formatMessage(404, body), cause) {
override fun statusCode(): Int = 404
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/PermissionDeniedException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/PermissionDeniedException.kt
index 5e2d1f819..d338288b4 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/PermissionDeniedException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/PermissionDeniedException.kt
@@ -10,7 +10,7 @@ import kotlin.jvm.optionals.getOrNull
class PermissionDeniedException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- LangChainServiceException("403: $body", cause) {
+ LangChainServiceException(formatMessage(403, body), cause) {
override fun statusCode(): Int = 403
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/RateLimitException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/RateLimitException.kt
index b8eda17b1..066d694a1 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/RateLimitException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/RateLimitException.kt
@@ -10,7 +10,7 @@ import kotlin.jvm.optionals.getOrNull
class RateLimitException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- LangChainServiceException("429: $body", cause) {
+ LangChainServiceException(formatMessage(429, body), cause) {
override fun statusCode(): Int = 429
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnauthorizedException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnauthorizedException.kt
index d2c472329..7323d1806 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnauthorizedException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnauthorizedException.kt
@@ -10,7 +10,7 @@ import kotlin.jvm.optionals.getOrNull
class UnauthorizedException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- LangChainServiceException("401: $body", cause) {
+ LangChainServiceException(formatMessage(401, body), cause) {
override fun statusCode(): Int = 401
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnexpectedStatusCodeException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnexpectedStatusCodeException.kt
index d66069ed3..6c41c6233 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnexpectedStatusCodeException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnexpectedStatusCodeException.kt
@@ -14,7 +14,7 @@ private constructor(
private val headers: Headers,
private val body: JsonValue,
cause: Throwable?,
-) : LangChainServiceException("$statusCode: $body", cause) {
+) : LangChainServiceException(formatMessage(statusCode, body), cause) {
override fun statusCode(): Int = statusCode
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnprocessableEntityException.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnprocessableEntityException.kt
index 5b38550df..e18c5988e 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnprocessableEntityException.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/errors/UnprocessableEntityException.kt
@@ -10,7 +10,7 @@ import kotlin.jvm.optionals.getOrNull
class UnprocessableEntityException
private constructor(private val headers: Headers, private val body: JsonValue, cause: Throwable?) :
- LangChainServiceException("422: $body", cause) {
+ LangChainServiceException(formatMessage(422, body), cause) {
override fun statusCode(): Int = 422
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueExportParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueExportParams.kt
index 579da9a65..4dc333d12 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueExportParams.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueExportParams.kt
@@ -37,6 +37,12 @@ private constructor(
*/
fun endTime(): Optional = body.endTime()
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun includeAnnotatorDetail(): Optional = body.includeAnnotatorDetail()
+
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -50,6 +56,14 @@ private constructor(
*/
fun _endTime(): JsonField = body._endTime()
+ /**
+ * Returns the raw JSON value of [includeAnnotatorDetail].
+ *
+ * Unlike [includeAnnotatorDetail], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ fun _includeAnnotatorDetail(): JsonField = body._includeAnnotatorDetail()
+
/**
* Returns the raw JSON value of [startTime].
*
@@ -104,6 +118,7 @@ private constructor(
* 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:
* - [endTime]
+ * - [includeAnnotatorDetail]
* - [startTime]
*/
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -122,6 +137,21 @@ private constructor(
*/
fun endTime(endTime: JsonField) = apply { body.endTime(endTime) }
+ fun includeAnnotatorDetail(includeAnnotatorDetail: Boolean) = apply {
+ body.includeAnnotatorDetail(includeAnnotatorDetail)
+ }
+
+ /**
+ * Sets [Builder.includeAnnotatorDetail] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.includeAnnotatorDetail] with a well-typed [Boolean]
+ * value instead. This method is primarily for setting the field to an undocumented or not
+ * yet supported value.
+ */
+ fun includeAnnotatorDetail(includeAnnotatorDetail: JsonField) = apply {
+ body.includeAnnotatorDetail(includeAnnotatorDetail)
+ }
+
fun startTime(startTime: OffsetDateTime?) = apply { body.startTime(startTime) }
/** Alias for calling [Builder.startTime] with `startTime.orElse(null)`. */
@@ -284,6 +314,7 @@ private constructor(
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
private constructor(
private val endTime: JsonField,
+ private val includeAnnotatorDetail: JsonField,
private val startTime: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -293,10 +324,13 @@ private constructor(
@JsonProperty("end_time")
@ExcludeMissing
endTime: JsonField = JsonMissing.of(),
+ @JsonProperty("include_annotator_detail")
+ @ExcludeMissing
+ includeAnnotatorDetail: JsonField = JsonMissing.of(),
@JsonProperty("start_time")
@ExcludeMissing
startTime: JsonField = JsonMissing.of(),
- ) : this(endTime, startTime, mutableMapOf())
+ ) : this(endTime, includeAnnotatorDetail, startTime, mutableMapOf())
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
@@ -304,6 +338,13 @@ private constructor(
*/
fun endTime(): Optional = endTime.getOptional("end_time")
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
+ * the server responded with an unexpected value).
+ */
+ fun includeAnnotatorDetail(): Optional =
+ includeAnnotatorDetail.getOptional("include_annotator_detail")
+
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
* the server responded with an unexpected value).
@@ -319,6 +360,16 @@ private constructor(
@ExcludeMissing
fun _endTime(): JsonField = endTime
+ /**
+ * Returns the raw JSON value of [includeAnnotatorDetail].
+ *
+ * Unlike [includeAnnotatorDetail], this method doesn't throw if the JSON field has an
+ * unexpected type.
+ */
+ @JsonProperty("include_annotator_detail")
+ @ExcludeMissing
+ fun _includeAnnotatorDetail(): JsonField = includeAnnotatorDetail
+
/**
* Returns the raw JSON value of [startTime].
*
@@ -350,12 +401,14 @@ private constructor(
class Builder internal constructor() {
private var endTime: JsonField = JsonMissing.of()
+ private var includeAnnotatorDetail: JsonField = JsonMissing.of()
private var startTime: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(body: Body) = apply {
endTime = body.endTime
+ includeAnnotatorDetail = body.includeAnnotatorDetail
startTime = body.startTime
additionalProperties = body.additionalProperties.toMutableMap()
}
@@ -374,6 +427,20 @@ private constructor(
*/
fun endTime(endTime: JsonField) = apply { this.endTime = endTime }
+ fun includeAnnotatorDetail(includeAnnotatorDetail: Boolean) =
+ includeAnnotatorDetail(JsonField.of(includeAnnotatorDetail))
+
+ /**
+ * Sets [Builder.includeAnnotatorDetail] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.includeAnnotatorDetail] with a well-typed [Boolean]
+ * value instead. This method is primarily for setting the field to an undocumented or
+ * not yet supported value.
+ */
+ fun includeAnnotatorDetail(includeAnnotatorDetail: JsonField) = apply {
+ this.includeAnnotatorDetail = includeAnnotatorDetail
+ }
+
fun startTime(startTime: OffsetDateTime?) = startTime(JsonField.ofNullable(startTime))
/** Alias for calling [Builder.startTime] with `startTime.orElse(null)`. */
@@ -414,7 +481,13 @@ private constructor(
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
- fun build(): Body = Body(endTime, startTime, additionalProperties.toMutableMap())
+ fun build(): Body =
+ Body(
+ endTime,
+ includeAnnotatorDetail,
+ startTime,
+ additionalProperties.toMutableMap(),
+ )
}
private var validated: Boolean = false
@@ -425,6 +498,7 @@ private constructor(
}
endTime()
+ includeAnnotatorDetail()
startTime()
validated = true
}
@@ -446,6 +520,7 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (endTime.asKnown().isPresent) 1 else 0) +
+ (if (includeAnnotatorDetail.asKnown().isPresent) 1 else 0) +
(if (startTime.asKnown().isPresent) 1 else 0)
override fun equals(other: Any?): Boolean {
@@ -455,16 +530,19 @@ private constructor(
return other is Body &&
endTime == other.endTime &&
+ includeAnnotatorDetail == other.includeAnnotatorDetail &&
startTime == other.startTime &&
additionalProperties == other.additionalProperties
}
- private val hashCode: Int by lazy { Objects.hash(endTime, startTime, additionalProperties) }
+ private val hashCode: Int by lazy {
+ Objects.hash(endTime, includeAnnotatorDetail, startTime, additionalProperties)
+ }
override fun hashCode(): Int = hashCode
override fun toString() =
- "Body{endTime=$endTime, startTime=$startTime, additionalProperties=$additionalProperties}"
+ "Body{endTime=$endTime, includeAnnotatorDetail=$includeAnnotatorDetail, startTime=$startTime, additionalProperties=$additionalProperties}"
}
override fun equals(other: Any?): Boolean {
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueRetrieveSizeParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueRetrieveSizeParams.kt
index f90faab0c..604ba02a3 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueRetrieveSizeParams.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/AnnotationQueueRetrieveSizeParams.kt
@@ -2,9 +2,13 @@
package com.langchain.smith.models.annotationqueues
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.langchain.smith.core.Enum
+import com.langchain.smith.core.JsonField
import com.langchain.smith.core.Params
import com.langchain.smith.core.http.Headers
import com.langchain.smith.core.http.QueryParams
+import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -13,12 +17,15 @@ import kotlin.jvm.optionals.getOrNull
class AnnotationQueueRetrieveSizeParams
private constructor(
private val queueId: String?,
+ private val status: Status?,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
fun queueId(): Optional = Optional.ofNullable(queueId)
+ fun status(): Optional = Optional.ofNullable(status)
+
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -42,6 +49,7 @@ private constructor(
class Builder internal constructor() {
private var queueId: String? = null
+ private var status: Status? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -49,6 +57,7 @@ private constructor(
internal fun from(annotationQueueRetrieveSizeParams: AnnotationQueueRetrieveSizeParams) =
apply {
queueId = annotationQueueRetrieveSizeParams.queueId
+ status = annotationQueueRetrieveSizeParams.status
additionalHeaders = annotationQueueRetrieveSizeParams.additionalHeaders.toBuilder()
additionalQueryParams =
annotationQueueRetrieveSizeParams.additionalQueryParams.toBuilder()
@@ -59,6 +68,11 @@ private constructor(
/** Alias for calling [Builder.queueId] with `queueId.orElse(null)`. */
fun queueId(queueId: Optional) = queueId(queueId.getOrNull())
+ fun status(status: Status?) = apply { this.status = status }
+
+ /** Alias for calling [Builder.status] with `status.orElse(null)`. */
+ fun status(status: Optional) = status(status.getOrNull())
+
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
putAllAdditionalHeaders(additionalHeaders)
@@ -165,6 +179,7 @@ private constructor(
fun build(): AnnotationQueueRetrieveSizeParams =
AnnotationQueueRetrieveSizeParams(
queueId,
+ status,
additionalHeaders.build(),
additionalQueryParams.build(),
)
@@ -178,7 +193,146 @@ private constructor(
override fun _headers(): Headers = additionalHeaders
- override fun _queryParams(): QueryParams = additionalQueryParams
+ override fun _queryParams(): QueryParams =
+ QueryParams.builder()
+ .apply {
+ status?.let { put("status", it.toString()) }
+ putAll(additionalQueryParams)
+ }
+ .build()
+
+ class Status @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 NEEDS_MY_REVIEW = of("needs_my_review")
+
+ @JvmField val NEEDS_OTHERS_REVIEW = of("needs_others_review")
+
+ @JvmField val COMPLETED = of("completed")
+
+ @JvmStatic fun of(value: String) = Status(JsonField.of(value))
+ }
+
+ /** An enum containing [Status]'s known values. */
+ enum class Known {
+ NEEDS_MY_REVIEW,
+ NEEDS_OTHERS_REVIEW,
+ COMPLETED,
+ }
+
+ /**
+ * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Status] 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 {
+ NEEDS_MY_REVIEW,
+ NEEDS_OTHERS_REVIEW,
+ COMPLETED,
+ /** An enum member indicating that [Status] 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) {
+ NEEDS_MY_REVIEW -> Value.NEEDS_MY_REVIEW
+ NEEDS_OTHERS_REVIEW -> Value.NEEDS_OTHERS_REVIEW
+ COMPLETED -> Value.COMPLETED
+ 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) {
+ NEEDS_MY_REVIEW -> Known.NEEDS_MY_REVIEW
+ NEEDS_OTHERS_REVIEW -> Known.NEEDS_OTHERS_REVIEW
+ COMPLETED -> Known.COMPLETED
+ else -> throw LangChainInvalidDataException("Unknown Status: $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(): Status = 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 Status && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
override fun equals(other: Any?): Boolean {
if (this === other) {
@@ -187,12 +341,14 @@ private constructor(
return other is AnnotationQueueRetrieveSizeParams &&
queueId == other.queueId &&
+ status == other.status &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
- override fun hashCode(): Int = Objects.hash(queueId, additionalHeaders, additionalQueryParams)
+ override fun hashCode(): Int =
+ Objects.hash(queueId, status, additionalHeaders, additionalQueryParams)
override fun toString() =
- "AnnotationQueueRetrieveSizeParams{queueId=$queueId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "AnnotationQueueRetrieveSizeParams{queueId=$queueId, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
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 52dbe98a5..df3073419 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
@@ -15,6 +15,7 @@ import com.langchain.smith.core.checkKnown
import com.langchain.smith.core.checkRequired
import com.langchain.smith.core.toImmutable
import com.langchain.smith.errors.LangChainInvalidDataException
+import com.langchain.smith.models.runs.RunTypeEnum
import java.time.OffsetDateTime
import java.util.Collections
import java.util.Objects
@@ -30,7 +31,7 @@ private constructor(
private val dottedOrder: JsonField,
private val name: JsonField,
private val queueRunId: JsonField,
- private val runType: JsonField,
+ private val runType: JsonField,
private val sessionId: JsonField,
private val status: JsonField,
private val traceId: JsonField,
@@ -98,7 +99,9 @@ private constructor(
@JsonProperty("queue_run_id")
@ExcludeMissing
queueRunId: JsonField = JsonMissing.of(),
- @JsonProperty("run_type") @ExcludeMissing runType: JsonField = JsonMissing.of(),
+ @JsonProperty("run_type")
+ @ExcludeMissing
+ runType: JsonField = JsonMissing.of(),
@JsonProperty("session_id") @ExcludeMissing sessionId: JsonField = JsonMissing.of(),
@JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(),
@JsonProperty("trace_id") @ExcludeMissing traceId: JsonField = JsonMissing.of(),
@@ -331,7 +334,7 @@ private constructor(
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
* unexpectedly missing or null (e.g. if the server responded with an unexpected value).
*/
- fun runType(): RunType = runType.getRequired("run_type")
+ fun runType(): RunTypeEnum = runType.getRequired("run_type")
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type or is
@@ -705,7 +708,7 @@ private constructor(
*
* Unlike [runType], this method doesn't throw if the JSON field has an unexpected type.
*/
- @JsonProperty("run_type") @ExcludeMissing fun _runType(): JsonField = runType
+ @JsonProperty("run_type") @ExcludeMissing fun _runType(): JsonField = runType
/**
* Returns the raw JSON value of [sessionId].
@@ -1195,7 +1198,7 @@ private constructor(
private var dottedOrder: JsonField? = null
private var name: JsonField? = null
private var queueRunId: JsonField? = null
- private var runType: JsonField? = null
+ private var runType: JsonField? = null
private var sessionId: JsonField? = null
private var status: JsonField? = null
private var traceId: JsonField? = null
@@ -1373,15 +1376,16 @@ private constructor(
fun queueRunId(queueRunId: JsonField) = apply { this.queueRunId = queueRunId }
/** Enum for run types. */
- fun runType(runType: RunType) = runType(JsonField.of(runType))
+ fun runType(runType: RunTypeEnum) = runType(JsonField.of(runType))
/**
* Sets [Builder.runType] to an arbitrary JSON value.
*
- * You should usually call [Builder.runType] with a well-typed [RunType] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
+ * You should usually call [Builder.runType] with a well-typed [RunTypeEnum] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
*/
- fun runType(runType: JsonField) = apply { this.runType = runType }
+ fun runType(runType: JsonField) = apply { this.runType = runType }
fun sessionId(sessionId: String) = sessionId(JsonField.of(sessionId))
@@ -2539,164 +2543,6 @@ private constructor(
(if (traceUpgrade.asKnown().isPresent) 1 else 0) +
(if (ttlSeconds.asKnown().isPresent) 1 else 0)
- /** Enum for run types. */
- class RunType @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 TOOL = of("tool")
-
- @JvmField val CHAIN = of("chain")
-
- @JvmField val LLM = of("llm")
-
- @JvmField val RETRIEVER = of("retriever")
-
- @JvmField val EMBEDDING = of("embedding")
-
- @JvmField val PROMPT = of("prompt")
-
- @JvmField val PARSER = of("parser")
-
- @JvmStatic fun of(value: String) = RunType(JsonField.of(value))
- }
-
- /** An enum containing [RunType]'s known values. */
- enum class Known {
- TOOL,
- CHAIN,
- LLM,
- RETRIEVER,
- EMBEDDING,
- PROMPT,
- PARSER,
- }
-
- /**
- * An enum containing [RunType]'s known values, as well as an [_UNKNOWN] member.
- *
- * An instance of [RunType] 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 {
- TOOL,
- CHAIN,
- LLM,
- RETRIEVER,
- EMBEDDING,
- PROMPT,
- PARSER,
- /** An enum member indicating that [RunType] 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) {
- TOOL -> Value.TOOL
- CHAIN -> Value.CHAIN
- LLM -> Value.LLM
- RETRIEVER -> Value.RETRIEVER
- EMBEDDING -> Value.EMBEDDING
- PROMPT -> Value.PROMPT
- PARSER -> Value.PARSER
- 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) {
- TOOL -> Known.TOOL
- CHAIN -> Known.CHAIN
- LLM -> Known.LLM
- RETRIEVER -> Known.RETRIEVER
- EMBEDDING -> Known.EMBEDDING
- PROMPT -> Known.PROMPT
- PARSER -> Known.PARSER
- else -> throw LangChainInvalidDataException("Unknown RunType: $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(): RunType = 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 RunType && value == other.value
- }
-
- override fun hashCode() = value.hashCode()
-
- override fun toString() = value.toString()
- }
-
class CompletionCostDetails
@JsonCreator
private constructor(
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/info/InfoListResponse.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/info/InfoListResponse.kt
index c456413b4..ed8a5a304 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/info/InfoListResponse.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/info/InfoListResponse.kt
@@ -26,6 +26,7 @@ private constructor(
private val version: JsonField,
private val batchIngestConfig: JsonField,
private val customerInfo: JsonField,
+ private val gitSha: JsonField,
private val instanceFlags: JsonField,
private val licenseExpirationTime: JsonField,
private val additionalProperties: MutableMap,
@@ -40,6 +41,7 @@ private constructor(
@JsonProperty("customer_info")
@ExcludeMissing
customerInfo: JsonField = JsonMissing.of(),
+ @JsonProperty("git_sha") @ExcludeMissing gitSha: JsonField = JsonMissing.of(),
@JsonProperty("instance_flags")
@ExcludeMissing
instanceFlags: JsonField = JsonMissing.of(),
@@ -50,6 +52,7 @@ private constructor(
version,
batchIngestConfig,
customerInfo,
+ gitSha,
instanceFlags,
licenseExpirationTime,
mutableMapOf(),
@@ -78,6 +81,12 @@ private constructor(
*/
fun customerInfo(): Optional = customerInfo.getOptional("customer_info")
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun gitSha(): Optional = gitSha.getOptional("git_sha")
+
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
@@ -117,6 +126,13 @@ private constructor(
@ExcludeMissing
fun _customerInfo(): JsonField = customerInfo
+ /**
+ * Returns the raw JSON value of [gitSha].
+ *
+ * Unlike [gitSha], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("git_sha") @ExcludeMissing fun _gitSha(): JsonField = gitSha
+
/**
* Returns the raw JSON value of [instanceFlags].
*
@@ -167,6 +183,7 @@ private constructor(
private var version: JsonField? = null
private var batchIngestConfig: JsonField = JsonMissing.of()
private var customerInfo: JsonField = JsonMissing.of()
+ private var gitSha: JsonField = JsonMissing.of()
private var instanceFlags: JsonField = JsonMissing.of()
private var licenseExpirationTime: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@@ -176,6 +193,7 @@ private constructor(
version = infoListResponse.version
batchIngestConfig = infoListResponse.batchIngestConfig
customerInfo = infoListResponse.customerInfo
+ gitSha = infoListResponse.gitSha
instanceFlags = infoListResponse.instanceFlags
licenseExpirationTime = infoListResponse.licenseExpirationTime
additionalProperties = infoListResponse.additionalProperties.toMutableMap()
@@ -225,6 +243,19 @@ private constructor(
this.customerInfo = customerInfo
}
+ fun gitSha(gitSha: String?) = gitSha(JsonField.ofNullable(gitSha))
+
+ /** Alias for calling [Builder.gitSha] with `gitSha.orElse(null)`. */
+ fun gitSha(gitSha: Optional) = gitSha(gitSha.getOrNull())
+
+ /**
+ * Sets [Builder.gitSha] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.gitSha] with a well-typed [String] value instead. This
+ * method is primarily for setting the field to an undocumented or not yet supported value.
+ */
+ fun gitSha(gitSha: JsonField) = apply { this.gitSha = gitSha }
+
fun instanceFlags(instanceFlags: InstanceFlags) = instanceFlags(JsonField.of(instanceFlags))
/**
@@ -295,6 +326,7 @@ private constructor(
checkRequired("version", version),
batchIngestConfig,
customerInfo,
+ gitSha,
instanceFlags,
licenseExpirationTime,
additionalProperties.toMutableMap(),
@@ -311,6 +343,7 @@ private constructor(
version()
batchIngestConfig().ifPresent { it.validate() }
customerInfo().ifPresent { it.validate() }
+ gitSha()
instanceFlags().ifPresent { it.validate() }
licenseExpirationTime()
validated = true
@@ -334,6 +367,7 @@ private constructor(
(if (version.asKnown().isPresent) 1 else 0) +
(batchIngestConfig.asKnown().getOrNull()?.validity() ?: 0) +
(customerInfo.asKnown().getOrNull()?.validity() ?: 0) +
+ (if (gitSha.asKnown().isPresent) 1 else 0) +
(instanceFlags.asKnown().getOrNull()?.validity() ?: 0) +
(if (licenseExpirationTime.asKnown().isPresent) 1 else 0)
@@ -1019,6 +1053,7 @@ private constructor(
version == other.version &&
batchIngestConfig == other.batchIngestConfig &&
customerInfo == other.customerInfo &&
+ gitSha == other.gitSha &&
instanceFlags == other.instanceFlags &&
licenseExpirationTime == other.licenseExpirationTime &&
additionalProperties == other.additionalProperties
@@ -1029,6 +1064,7 @@ private constructor(
version,
batchIngestConfig,
customerInfo,
+ gitSha,
instanceFlags,
licenseExpirationTime,
additionalProperties,
@@ -1038,5 +1074,5 @@ private constructor(
override fun hashCode(): Int = hashCode
override fun toString() =
- "InfoListResponse{version=$version, batchIngestConfig=$batchIngestConfig, customerInfo=$customerInfo, instanceFlags=$instanceFlags, licenseExpirationTime=$licenseExpirationTime, additionalProperties=$additionalProperties}"
+ "InfoListResponse{version=$version, batchIngestConfig=$batchIngestConfig, customerInfo=$customerInfo, gitSha=$gitSha, instanceFlags=$instanceFlags, licenseExpirationTime=$licenseExpirationTime, additionalProperties=$additionalProperties}"
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunListParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunListParams.kt
index afad240b3..849be9374 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunListParams.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/annotationqueues/runs/RunListParams.kt
@@ -2,9 +2,13 @@
package com.langchain.smith.models.annotationqueues.runs
+import com.fasterxml.jackson.annotation.JsonCreator
+import com.langchain.smith.core.Enum
+import com.langchain.smith.core.JsonField
import com.langchain.smith.core.Params
import com.langchain.smith.core.http.Headers
import com.langchain.smith.core.http.QueryParams
+import com.langchain.smith.errors.LangChainInvalidDataException
import java.util.Objects
import java.util.Optional
import kotlin.jvm.optionals.getOrNull
@@ -17,6 +21,7 @@ private constructor(
private val includeStats: Boolean?,
private val limit: Long?,
private val offset: Long?,
+ private val status: Status?,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -31,6 +36,8 @@ private constructor(
fun offset(): Optional = Optional.ofNullable(offset)
+ fun status(): Optional = Optional.ofNullable(status)
+
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -55,6 +62,7 @@ private constructor(
private var includeStats: Boolean? = null
private var limit: Long? = null
private var offset: Long? = null
+ private var status: Status? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -65,6 +73,7 @@ private constructor(
includeStats = runListParams.includeStats
limit = runListParams.limit
offset = runListParams.offset
+ status = runListParams.status
additionalHeaders = runListParams.additionalHeaders.toBuilder()
additionalQueryParams = runListParams.additionalQueryParams.toBuilder()
}
@@ -122,6 +131,11 @@ private constructor(
/** Alias for calling [Builder.offset] with `offset.orElse(null)`. */
fun offset(offset: Optional) = offset(offset.getOrNull())
+ fun status(status: Status?) = apply { this.status = status }
+
+ /** Alias for calling [Builder.status] with `status.orElse(null)`. */
+ fun status(status: Optional) = status(status.getOrNull())
+
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
putAllAdditionalHeaders(additionalHeaders)
@@ -232,6 +246,7 @@ private constructor(
includeStats,
limit,
offset,
+ status,
additionalHeaders.build(),
additionalQueryParams.build(),
)
@@ -252,10 +267,144 @@ private constructor(
includeStats?.let { put("include_stats", it.toString()) }
limit?.let { put("limit", it.toString()) }
offset?.let { put("offset", it.toString()) }
+ status?.let { put("status", it.toString()) }
putAll(additionalQueryParams)
}
.build()
+ class Status @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 NEEDS_MY_REVIEW = of("needs_my_review")
+
+ @JvmField val NEEDS_OTHERS_REVIEW = of("needs_others_review")
+
+ @JvmField val COMPLETED = of("completed")
+
+ @JvmStatic fun of(value: String) = Status(JsonField.of(value))
+ }
+
+ /** An enum containing [Status]'s known values. */
+ enum class Known {
+ NEEDS_MY_REVIEW,
+ NEEDS_OTHERS_REVIEW,
+ COMPLETED,
+ }
+
+ /**
+ * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member.
+ *
+ * An instance of [Status] 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 {
+ NEEDS_MY_REVIEW,
+ NEEDS_OTHERS_REVIEW,
+ COMPLETED,
+ /** An enum member indicating that [Status] 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) {
+ NEEDS_MY_REVIEW -> Value.NEEDS_MY_REVIEW
+ NEEDS_OTHERS_REVIEW -> Value.NEEDS_OTHERS_REVIEW
+ COMPLETED -> Value.COMPLETED
+ 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) {
+ NEEDS_MY_REVIEW -> Known.NEEDS_MY_REVIEW
+ NEEDS_OTHERS_REVIEW -> Known.NEEDS_OTHERS_REVIEW
+ COMPLETED -> Known.COMPLETED
+ else -> throw LangChainInvalidDataException("Unknown Status: $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(): Status = 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 Status && value == other.value
+ }
+
+ override fun hashCode() = value.hashCode()
+
+ override fun toString() = value.toString()
+ }
+
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
@@ -267,6 +416,7 @@ private constructor(
includeStats == other.includeStats &&
limit == other.limit &&
offset == other.offset &&
+ status == other.status &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
@@ -278,10 +428,11 @@ private constructor(
includeStats,
limit,
offset,
+ status,
additionalHeaders,
additionalQueryParams,
)
override fun toString() =
- "RunListParams{queueId=$queueId, archived=$archived, includeStats=$includeStats, limit=$limit, offset=$offset, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "RunListParams{queueId=$queueId, archived=$archived, includeStats=$includeStats, limit=$limit, offset=$offset, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
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 6e5aeae9b..31c9ce315 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
@@ -23,6 +23,7 @@ private constructor(
private val includeStats: Boolean?,
private val limit: Long?,
private val offset: Long?,
+ private val tag: String?,
private val additionalHeaders: Headers,
private val additionalQueryParams: QueryParams,
) : Params {
@@ -40,6 +41,9 @@ private constructor(
/** Offset is the pagination offset */
fun offset(): Optional = Optional.ofNullable(offset)
+ /** Tag filters commits to only those with a specific tag (e.g. "production", "staging") */
+ fun tag(): Optional = Optional.ofNullable(tag)
+
/** Additional headers to send with the request. */
fun _additionalHeaders(): Headers = additionalHeaders
@@ -69,6 +73,7 @@ private constructor(
private var includeStats: Boolean? = null
private var limit: Long? = null
private var offset: Long? = null
+ private var tag: String? = null
private var additionalHeaders: Headers.Builder = Headers.builder()
private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
@@ -79,6 +84,7 @@ private constructor(
includeStats = commitListParams.includeStats
limit = commitListParams.limit
offset = commitListParams.offset
+ tag = commitListParams.tag
additionalHeaders = commitListParams.additionalHeaders.toBuilder()
additionalQueryParams = commitListParams.additionalQueryParams.toBuilder()
}
@@ -129,6 +135,12 @@ private constructor(
/** Alias for calling [Builder.offset] with `offset.orElse(null)`. */
fun offset(offset: Optional) = offset(offset.getOrNull())
+ /** Tag filters commits to only those with a specific tag (e.g. "production", "staging") */
+ fun tag(tag: String?) = apply { this.tag = tag }
+
+ /** Alias for calling [Builder.tag] with `tag.orElse(null)`. */
+ fun tag(tag: Optional) = tag(tag.getOrNull())
+
fun additionalHeaders(additionalHeaders: Headers) = apply {
this.additionalHeaders.clear()
putAllAdditionalHeaders(additionalHeaders)
@@ -246,6 +258,7 @@ private constructor(
includeStats,
limit,
offset,
+ tag,
additionalHeaders.build(),
additionalQueryParams.build(),
)
@@ -266,6 +279,7 @@ private constructor(
includeStats?.let { put("include_stats", it.toString()) }
limit?.let { put("limit", it.toString()) }
offset?.let { put("offset", it.toString()) }
+ tag?.let { put("tag", it) }
putAll(additionalQueryParams)
}
.build()
@@ -281,6 +295,7 @@ private constructor(
includeStats == other.includeStats &&
limit == other.limit &&
offset == other.offset &&
+ tag == other.tag &&
additionalHeaders == other.additionalHeaders &&
additionalQueryParams == other.additionalQueryParams
}
@@ -292,10 +307,11 @@ private constructor(
includeStats,
limit,
offset,
+ tag,
additionalHeaders,
additionalQueryParams,
)
override fun toString() =
- "CommitListParams{owner=$owner, repo=$repo, includeStats=$includeStats, limit=$limit, offset=$offset, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
+ "CommitListParams{owner=$owner, repo=$repo, includeStats=$includeStats, limit=$limit, offset=$offset, tag=$tag, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitRetrieveResponse.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitRetrieveResponse.kt
index 933b7f27f..6a622a7da 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitRetrieveResponse.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitRetrieveResponse.kt
@@ -24,6 +24,8 @@ private constructor(
private val commitHash: JsonField,
private val examples: JsonField>,
private val manifest: JsonValue,
+ private val modelConfig: JsonValue,
+ private val modelProvider: JsonField,
private val additionalProperties: MutableMap,
) {
@@ -36,7 +38,11 @@ private constructor(
@ExcludeMissing
examples: JsonField> = JsonMissing.of(),
@JsonProperty("manifest") @ExcludeMissing manifest: JsonValue = JsonMissing.of(),
- ) : this(commitHash, examples, manifest, mutableMapOf())
+ @JsonProperty("model_config") @ExcludeMissing modelConfig: JsonValue = JsonMissing.of(),
+ @JsonProperty("model_provider")
+ @ExcludeMissing
+ modelProvider: JsonField = JsonMissing.of(),
+ ) : this(commitHash, examples, manifest, modelConfig, modelProvider, mutableMapOf())
/**
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -58,6 +64,20 @@ private constructor(
*/
@JsonProperty("manifest") @ExcludeMissing fun _manifest(): JsonValue = manifest
+ /**
+ * This arbitrary value can be deserialized into a custom type using the `convert` method:
+ * ```java
+ * MyClass myObject = commitRetrieveResponse.modelConfig().convert(MyClass.class);
+ * ```
+ */
+ @JsonProperty("model_config") @ExcludeMissing fun _modelConfig(): JsonValue = modelConfig
+
+ /**
+ * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
+ * server responded with an unexpected value).
+ */
+ fun modelProvider(): Optional = modelProvider.getOptional("model_provider")
+
/**
* Returns the raw JSON value of [commitHash].
*
@@ -72,6 +92,15 @@ private constructor(
*/
@JsonProperty("examples") @ExcludeMissing fun _examples(): JsonField> = examples
+ /**
+ * Returns the raw JSON value of [modelProvider].
+ *
+ * Unlike [modelProvider], this method doesn't throw if the JSON field has an unexpected type.
+ */
+ @JsonProperty("model_provider")
+ @ExcludeMissing
+ fun _modelProvider(): JsonField = modelProvider
+
@JsonAnySetter
private fun putAdditionalProperty(key: String, value: JsonValue) {
additionalProperties.put(key, value)
@@ -96,6 +125,8 @@ private constructor(
private var commitHash: JsonField = JsonMissing.of()
private var examples: JsonField>? = null
private var manifest: JsonValue = JsonMissing.of()
+ private var modelConfig: JsonValue = JsonMissing.of()
+ private var modelProvider: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
@@ -103,6 +134,8 @@ private constructor(
commitHash = commitRetrieveResponse.commitHash
examples = commitRetrieveResponse.examples.map { it.toMutableList() }
manifest = commitRetrieveResponse.manifest
+ modelConfig = commitRetrieveResponse.modelConfig
+ modelProvider = commitRetrieveResponse.modelProvider
additionalProperties = commitRetrieveResponse.additionalProperties.toMutableMap()
}
@@ -144,6 +177,21 @@ private constructor(
fun manifest(manifest: JsonValue) = apply { this.manifest = manifest }
+ fun modelConfig(modelConfig: JsonValue) = apply { this.modelConfig = modelConfig }
+
+ fun modelProvider(modelProvider: String) = modelProvider(JsonField.of(modelProvider))
+
+ /**
+ * Sets [Builder.modelProvider] to an arbitrary JSON value.
+ *
+ * You should usually call [Builder.modelProvider] with a well-typed [String] value instead.
+ * This method is primarily for setting the field to an undocumented or not yet supported
+ * value.
+ */
+ fun modelProvider(modelProvider: JsonField) = apply {
+ this.modelProvider = modelProvider
+ }
+
fun additionalProperties(additionalProperties: Map) = apply {
this.additionalProperties.clear()
putAllAdditionalProperties(additionalProperties)
@@ -173,6 +221,8 @@ private constructor(
commitHash,
(examples ?: JsonMissing.of()).map { it.toImmutable() },
manifest,
+ modelConfig,
+ modelProvider,
additionalProperties.toMutableMap(),
)
}
@@ -186,6 +236,7 @@ private constructor(
commitHash()
examples().ifPresent { it.forEach { it.validate() } }
+ modelProvider()
validated = true
}
@@ -205,7 +256,8 @@ private constructor(
@JvmSynthetic
internal fun validity(): Int =
(if (commitHash.asKnown().isPresent) 1 else 0) +
- (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0)
+ (examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
+ (if (modelProvider.asKnown().isPresent) 1 else 0)
class Example
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
@@ -462,15 +514,24 @@ private constructor(
commitHash == other.commitHash &&
examples == other.examples &&
manifest == other.manifest &&
+ modelConfig == other.modelConfig &&
+ modelProvider == other.modelProvider &&
additionalProperties == other.additionalProperties
}
private val hashCode: Int by lazy {
- Objects.hash(commitHash, examples, manifest, additionalProperties)
+ Objects.hash(
+ commitHash,
+ examples,
+ manifest,
+ modelConfig,
+ modelProvider,
+ additionalProperties,
+ )
}
override fun hashCode(): Int = hashCode
override fun toString() =
- "CommitRetrieveResponse{commitHash=$commitHash, examples=$examples, manifest=$manifest, additionalProperties=$additionalProperties}"
+ "CommitRetrieveResponse{commitHash=$commitHash, examples=$examples, manifest=$manifest, modelConfig=$modelConfig, modelProvider=$modelProvider, additionalProperties=$additionalProperties}"
}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListPage.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListPage.kt
deleted file mode 100644
index e7242a5cb..000000000
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListPage.kt
+++ /dev/null
@@ -1,112 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.langchain.smith.models.datasets.comparative
-
-import com.langchain.smith.core.AutoPager
-import com.langchain.smith.core.Page
-import com.langchain.smith.core.checkRequired
-import com.langchain.smith.services.blocking.datasets.ComparativeService
-import java.util.Objects
-import kotlin.jvm.optionals.getOrDefault
-
-/** @see ComparativeService.list */
-class ComparativeListPage
-private constructor(
- private val service: ComparativeService,
- private val params: ComparativeListParams,
- private val items: List,
-) : Page {
-
- override fun hasNextPage(): Boolean = items().isNotEmpty()
-
- fun nextPageParams(): ComparativeListParams {
- val offset = params.offset().getOrDefault(0)
- return params.toBuilder().offset(offset + items().size).build()
- }
-
- override fun nextPage(): ComparativeListPage = service.list(nextPageParams())
-
- fun autoPager(): AutoPager = AutoPager.from(this)
-
- /** The parameters that were used to request this page. */
- fun params(): ComparativeListParams = params
-
- /** The response that this page was parsed from. */
- override fun items(): List = items
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [ComparativeListPage].
- *
- * The following fields are required:
- * ```java
- * .service()
- * .params()
- * .items()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [ComparativeListPage]. */
- class Builder internal constructor() {
-
- private var service: ComparativeService? = null
- private var params: ComparativeListParams? = null
- private var items: List? = null
-
- @JvmSynthetic
- internal fun from(comparativeListPage: ComparativeListPage) = apply {
- service = comparativeListPage.service
- params = comparativeListPage.params
- items = comparativeListPage.items
- }
-
- fun service(service: ComparativeService) = apply { this.service = service }
-
- /** The parameters that were used to request this page. */
- fun params(params: ComparativeListParams) = apply { this.params = params }
-
- /** The response that this page was parsed from. */
- fun items(items: List) = apply { this.items = items }
-
- /**
- * Returns an immutable instance of [ComparativeListPage].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .service()
- * .params()
- * .items()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): ComparativeListPage =
- ComparativeListPage(
- checkRequired("service", service),
- checkRequired("params", params),
- checkRequired("items", items),
- )
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ComparativeListPage &&
- service == other.service &&
- params == other.params &&
- items == other.items
- }
-
- override fun hashCode(): Int = Objects.hash(service, params, items)
-
- override fun toString() = "ComparativeListPage{service=$service, params=$params, items=$items}"
-}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListPageAsync.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListPageAsync.kt
deleted file mode 100644
index 5c0bf34c2..000000000
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListPageAsync.kt
+++ /dev/null
@@ -1,128 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.langchain.smith.models.datasets.comparative
-
-import com.langchain.smith.core.AutoPagerAsync
-import com.langchain.smith.core.PageAsync
-import com.langchain.smith.core.checkRequired
-import com.langchain.smith.services.async.datasets.ComparativeServiceAsync
-import java.util.Objects
-import java.util.concurrent.CompletableFuture
-import java.util.concurrent.Executor
-import kotlin.jvm.optionals.getOrDefault
-
-/** @see ComparativeServiceAsync.list */
-class ComparativeListPageAsync
-private constructor(
- private val service: ComparativeServiceAsync,
- private val streamHandlerExecutor: Executor,
- private val params: ComparativeListParams,
- private val items: List,
-) : PageAsync {
-
- override fun hasNextPage(): Boolean = items().isNotEmpty()
-
- fun nextPageParams(): ComparativeListParams {
- val offset = params.offset().getOrDefault(0)
- return params.toBuilder().offset(offset + items().size).build()
- }
-
- override fun nextPage(): CompletableFuture =
- service.list(nextPageParams())
-
- fun autoPager(): AutoPagerAsync =
- AutoPagerAsync.from(this, streamHandlerExecutor)
-
- /** The parameters that were used to request this page. */
- fun params(): ComparativeListParams = params
-
- /** The response that this page was parsed from. */
- override fun items(): List = items
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /**
- * Returns a mutable builder for constructing an instance of [ComparativeListPageAsync].
- *
- * The following fields are required:
- * ```java
- * .service()
- * .streamHandlerExecutor()
- * .params()
- * .items()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [ComparativeListPageAsync]. */
- class Builder internal constructor() {
-
- private var service: ComparativeServiceAsync? = null
- private var streamHandlerExecutor: Executor? = null
- private var params: ComparativeListParams? = null
- private var items: List? = null
-
- @JvmSynthetic
- internal fun from(comparativeListPageAsync: ComparativeListPageAsync) = apply {
- service = comparativeListPageAsync.service
- streamHandlerExecutor = comparativeListPageAsync.streamHandlerExecutor
- params = comparativeListPageAsync.params
- items = comparativeListPageAsync.items
- }
-
- fun service(service: ComparativeServiceAsync) = apply { this.service = service }
-
- fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply {
- this.streamHandlerExecutor = streamHandlerExecutor
- }
-
- /** The parameters that were used to request this page. */
- fun params(params: ComparativeListParams) = apply { this.params = params }
-
- /** The response that this page was parsed from. */
- fun items(items: List) = apply { this.items = items }
-
- /**
- * Returns an immutable instance of [ComparativeListPageAsync].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .service()
- * .streamHandlerExecutor()
- * .params()
- * .items()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): ComparativeListPageAsync =
- ComparativeListPageAsync(
- checkRequired("service", service),
- checkRequired("streamHandlerExecutor", streamHandlerExecutor),
- checkRequired("params", params),
- checkRequired("items", items),
- )
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ComparativeListPageAsync &&
- service == other.service &&
- streamHandlerExecutor == other.streamHandlerExecutor &&
- params == other.params &&
- items == other.items
- }
-
- override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, items)
-
- override fun toString() =
- "ComparativeListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, items=$items}"
-}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListParams.kt
deleted file mode 100644
index e9de87387..000000000
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListParams.kt
+++ /dev/null
@@ -1,332 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.langchain.smith.models.datasets.comparative
-
-import com.langchain.smith.core.Params
-import com.langchain.smith.core.http.Headers
-import com.langchain.smith.core.http.QueryParams
-import com.langchain.smith.core.toImmutable
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-/** Get all comparative experiments for a given dataset. */
-class ComparativeListParams
-private constructor(
- private val datasetId: String?,
- private val id: List?,
- private val limit: Long?,
- private val name: String?,
- private val nameContains: String?,
- private val offset: Long?,
- private val sortBy: SortByComparativeExperimentColumn?,
- private val sortByDesc: Boolean?,
- private val additionalHeaders: Headers,
- private val additionalQueryParams: QueryParams,
-) : Params {
-
- fun datasetId(): Optional = Optional.ofNullable(datasetId)
-
- fun id(): Optional> = Optional.ofNullable(id)
-
- fun limit(): Optional = Optional.ofNullable(limit)
-
- fun name(): Optional = Optional.ofNullable(name)
-
- fun nameContains(): Optional = Optional.ofNullable(nameContains)
-
- fun offset(): Optional = Optional.ofNullable(offset)
-
- /** Enum for available comparative experiment columns to sort by. */
- fun sortBy(): Optional = Optional.ofNullable(sortBy)
-
- fun sortByDesc(): Optional = Optional.ofNullable(sortByDesc)
-
- /** Additional headers to send with the request. */
- fun _additionalHeaders(): Headers = additionalHeaders
-
- /** Additional query param to send with the request. */
- fun _additionalQueryParams(): QueryParams = additionalQueryParams
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- @JvmStatic fun none(): ComparativeListParams = builder().build()
-
- /** Returns a mutable builder for constructing an instance of [ComparativeListParams]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [ComparativeListParams]. */
- class Builder internal constructor() {
-
- private var datasetId: String? = null
- private var id: MutableList? = null
- private var limit: Long? = null
- private var name: String? = null
- private var nameContains: String? = null
- private var offset: Long? = null
- private var sortBy: SortByComparativeExperimentColumn? = null
- private var sortByDesc: Boolean? = null
- private var additionalHeaders: Headers.Builder = Headers.builder()
- private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
-
- @JvmSynthetic
- internal fun from(comparativeListParams: ComparativeListParams) = apply {
- datasetId = comparativeListParams.datasetId
- id = comparativeListParams.id?.toMutableList()
- limit = comparativeListParams.limit
- name = comparativeListParams.name
- nameContains = comparativeListParams.nameContains
- offset = comparativeListParams.offset
- sortBy = comparativeListParams.sortBy
- sortByDesc = comparativeListParams.sortByDesc
- additionalHeaders = comparativeListParams.additionalHeaders.toBuilder()
- additionalQueryParams = comparativeListParams.additionalQueryParams.toBuilder()
- }
-
- fun datasetId(datasetId: String?) = apply { this.datasetId = datasetId }
-
- /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */
- fun datasetId(datasetId: Optional) = datasetId(datasetId.getOrNull())
-
- fun id(id: List?) = apply { this.id = id?.toMutableList() }
-
- /** Alias for calling [Builder.id] with `id.orElse(null)`. */
- fun id(id: Optional>) = id(id.getOrNull())
-
- /**
- * Adds a single [String] to [Builder.id].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addId(id: String) = apply { this.id = (this.id ?: mutableListOf()).apply { add(id) } }
-
- fun limit(limit: Long?) = apply { this.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())
-
- fun name(name: String?) = apply { this.name = name }
-
- /** Alias for calling [Builder.name] with `name.orElse(null)`. */
- fun name(name: Optional) = name(name.getOrNull())
-
- fun nameContains(nameContains: String?) = apply { this.nameContains = nameContains }
-
- /** Alias for calling [Builder.nameContains] with `nameContains.orElse(null)`. */
- fun nameContains(nameContains: Optional) = nameContains(nameContains.getOrNull())
-
- fun offset(offset: Long?) = apply { this.offset = offset }
-
- /**
- * Alias for [Builder.offset].
- *
- * This unboxed primitive overload exists for backwards compatibility.
- */
- fun offset(offset: Long) = offset(offset as Long?)
-
- /** Alias for calling [Builder.offset] with `offset.orElse(null)`. */
- fun offset(offset: Optional) = offset(offset.getOrNull())
-
- /** Enum for available comparative experiment columns to sort by. */
- fun sortBy(sortBy: SortByComparativeExperimentColumn?) = apply { this.sortBy = sortBy }
-
- /** Alias for calling [Builder.sortBy] with `sortBy.orElse(null)`. */
- fun sortBy(sortBy: Optional) = sortBy(sortBy.getOrNull())
-
- fun sortByDesc(sortByDesc: Boolean?) = apply { this.sortByDesc = sortByDesc }
-
- /**
- * Alias for [Builder.sortByDesc].
- *
- * This unboxed primitive overload exists for backwards compatibility.
- */
- fun sortByDesc(sortByDesc: Boolean) = sortByDesc(sortByDesc as Boolean?)
-
- /** Alias for calling [Builder.sortByDesc] with `sortByDesc.orElse(null)`. */
- fun sortByDesc(sortByDesc: Optional) = sortByDesc(sortByDesc.getOrNull())
-
- fun additionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
-
- fun additionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
-
- fun putAdditionalHeader(name: String, value: String) = apply {
- additionalHeaders.put(name, value)
- }
-
- fun putAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.put(name, values)
- }
-
- fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
-
- fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
-
- fun replaceAdditionalHeaders(name: String, value: String) = apply {
- additionalHeaders.replace(name, value)
- }
-
- fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.replace(name, values)
- }
-
- fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
-
- fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
-
- fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
-
- fun removeAllAdditionalHeaders(names: Set) = apply {
- additionalHeaders.removeAll(names)
- }
-
- fun additionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.clear()
- putAllAdditionalQueryParams(additionalQueryParams)
- }
-
- fun additionalQueryParams(additionalQueryParams: Map>) = apply {
- this.additionalQueryParams.clear()
- putAllAdditionalQueryParams(additionalQueryParams)
- }
-
- fun putAdditionalQueryParam(key: String, value: String) = apply {
- additionalQueryParams.put(key, value)
- }
-
- fun putAdditionalQueryParams(key: String, values: Iterable) = apply {
- additionalQueryParams.put(key, values)
- }
-
- fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.putAll(additionalQueryParams)
- }
-
- fun putAllAdditionalQueryParams(additionalQueryParams: Map>) =
- apply {
- this.additionalQueryParams.putAll(additionalQueryParams)
- }
-
- fun replaceAdditionalQueryParams(key: String, value: String) = apply {
- additionalQueryParams.replace(key, value)
- }
-
- fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply {
- additionalQueryParams.replace(key, values)
- }
-
- fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply {
- this.additionalQueryParams.replaceAll(additionalQueryParams)
- }
-
- fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) =
- apply {
- this.additionalQueryParams.replaceAll(additionalQueryParams)
- }
-
- fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) }
-
- fun removeAllAdditionalQueryParams(keys: Set) = apply {
- additionalQueryParams.removeAll(keys)
- }
-
- /**
- * Returns an immutable instance of [ComparativeListParams].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): ComparativeListParams =
- ComparativeListParams(
- datasetId,
- id?.toImmutable(),
- limit,
- name,
- nameContains,
- offset,
- sortBy,
- sortByDesc,
- additionalHeaders.build(),
- additionalQueryParams.build(),
- )
- }
-
- fun _pathParam(index: Int): String =
- when (index) {
- 0 -> datasetId ?: ""
- else -> ""
- }
-
- override fun _headers(): Headers = additionalHeaders
-
- override fun _queryParams(): QueryParams =
- QueryParams.builder()
- .apply {
- id?.let { put("id", it.joinToString(",")) }
- limit?.let { put("limit", it.toString()) }
- name?.let { put("name", it) }
- nameContains?.let { put("name_contains", it) }
- offset?.let { put("offset", it.toString()) }
- sortBy?.let { put("sort_by", it.toString()) }
- sortByDesc?.let { put("sort_by_desc", it.toString()) }
- putAll(additionalQueryParams)
- }
- .build()
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ComparativeListParams &&
- datasetId == other.datasetId &&
- id == other.id &&
- limit == other.limit &&
- name == other.name &&
- nameContains == other.nameContains &&
- offset == other.offset &&
- sortBy == other.sortBy &&
- sortByDesc == other.sortByDesc &&
- additionalHeaders == other.additionalHeaders &&
- additionalQueryParams == other.additionalQueryParams
- }
-
- override fun hashCode(): Int =
- Objects.hash(
- datasetId,
- id,
- limit,
- name,
- nameContains,
- offset,
- sortBy,
- sortByDesc,
- additionalHeaders,
- additionalQueryParams,
- )
-
- override fun toString() =
- "ComparativeListParams{datasetId=$datasetId, id=$id, limit=$limit, name=$name, nameContains=$nameContains, offset=$offset, sortBy=$sortBy, sortByDesc=$sortByDesc, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
-}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListResponse.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListResponse.kt
deleted file mode 100644
index a52a32302..000000000
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/comparative/ComparativeListResponse.kt
+++ /dev/null
@@ -1,757 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.langchain.smith.models.datasets.comparative
-
-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.ExcludeMissing
-import com.langchain.smith.core.JsonField
-import com.langchain.smith.core.JsonMissing
-import com.langchain.smith.core.JsonValue
-import com.langchain.smith.core.checkKnown
-import com.langchain.smith.core.checkRequired
-import com.langchain.smith.core.toImmutable
-import com.langchain.smith.errors.LangChainInvalidDataException
-import java.time.OffsetDateTime
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-/** ComparativeExperiment schema. */
-class ComparativeListResponse
-@JsonCreator(mode = JsonCreator.Mode.DISABLED)
-private constructor(
- private val id: JsonField,
- private val createdAt: JsonField,
- private val experimentsInfo: JsonField>,
- private val modifiedAt: JsonField,
- private val referenceDatasetId: JsonField,
- private val tenantId: JsonField,
- private val description: JsonField,
- private val extra: JsonField,
- private val feedbackStats: JsonField,
- private val name: JsonField,
- private val additionalProperties: MutableMap,
-) {
-
- @JsonCreator
- private constructor(
- @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(),
- @JsonProperty("created_at")
- @ExcludeMissing
- createdAt: JsonField = JsonMissing.of(),
- @JsonProperty("experiments_info")
- @ExcludeMissing
- experimentsInfo: JsonField> = JsonMissing.of(),
- @JsonProperty("modified_at")
- @ExcludeMissing
- modifiedAt: JsonField = JsonMissing.of(),
- @JsonProperty("reference_dataset_id")
- @ExcludeMissing
- referenceDatasetId: JsonField = JsonMissing.of(),
- @JsonProperty("tenant_id") @ExcludeMissing tenantId: JsonField = JsonMissing.of(),
- @JsonProperty("description")
- @ExcludeMissing
- description: JsonField = JsonMissing.of(),
- @JsonProperty("extra") @ExcludeMissing extra: JsonField = JsonMissing.of(),
- @JsonProperty("feedback_stats")
- @ExcludeMissing
- feedbackStats: JsonField = JsonMissing.of(),
- @JsonProperty("name") @ExcludeMissing name: JsonField = JsonMissing.of(),
- ) : this(
- id,
- createdAt,
- experimentsInfo,
- modifiedAt,
- referenceDatasetId,
- tenantId,
- description,
- extra,
- feedbackStats,
- name,
- 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 id(): String = id.getRequired("id")
-
- /**
- * @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 createdAt(): OffsetDateTime = createdAt.getRequired("created_at")
-
- /**
- * @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 experimentsInfo(): List =
- experimentsInfo.getRequired("experiments_info")
-
- /**
- * @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 modifiedAt(): OffsetDateTime = modifiedAt.getRequired("modified_at")
-
- /**
- * @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 referenceDatasetId(): String = referenceDatasetId.getRequired("reference_dataset_id")
-
- /**
- * @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 tenantId(): String = tenantId.getRequired("tenant_id")
-
- /**
- * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun description(): Optional = description.getOptional("description")
-
- /**
- * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun extra(): Optional = extra.getOptional("extra")
-
- /**
- * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun feedbackStats(): Optional = feedbackStats.getOptional("feedback_stats")
-
- /**
- * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun name(): Optional = name.getOptional("name")
-
- /**
- * Returns the raw JSON value of [id].
- *
- * Unlike [id], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id
-
- /**
- * Returns the raw JSON value of [createdAt].
- *
- * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("created_at")
- @ExcludeMissing
- fun _createdAt(): JsonField = createdAt
-
- /**
- * Returns the raw JSON value of [experimentsInfo].
- *
- * Unlike [experimentsInfo], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("experiments_info")
- @ExcludeMissing
- fun _experimentsInfo(): JsonField> = experimentsInfo
-
- /**
- * Returns the raw JSON value of [modifiedAt].
- *
- * Unlike [modifiedAt], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("modified_at")
- @ExcludeMissing
- fun _modifiedAt(): JsonField = modifiedAt
-
- /**
- * Returns the raw JSON value of [referenceDatasetId].
- *
- * Unlike [referenceDatasetId], this method doesn't throw if the JSON field has an unexpected
- * type.
- */
- @JsonProperty("reference_dataset_id")
- @ExcludeMissing
- fun _referenceDatasetId(): JsonField = referenceDatasetId
-
- /**
- * Returns the raw JSON value of [tenantId].
- *
- * Unlike [tenantId], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("tenant_id") @ExcludeMissing fun _tenantId(): JsonField = tenantId
-
- /**
- * Returns the raw JSON value of [description].
- *
- * Unlike [description], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("description") @ExcludeMissing fun _description(): JsonField = description
-
- /**
- * Returns the raw JSON value of [extra].
- *
- * Unlike [extra], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("extra") @ExcludeMissing fun _extra(): JsonField = extra
-
- /**
- * Returns the raw JSON value of [feedbackStats].
- *
- * Unlike [feedbackStats], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("feedback_stats")
- @ExcludeMissing
- fun _feedbackStats(): JsonField = feedbackStats
-
- /**
- * Returns the raw JSON value of [name].
- *
- * Unlike [name], this method doesn't throw if the JSON field has an unexpected type.
- */
- @JsonProperty("name") @ExcludeMissing fun _name(): JsonField = name
-
- @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 [ComparativeListResponse].
- *
- * The following fields are required:
- * ```java
- * .id()
- * .createdAt()
- * .experimentsInfo()
- * .modifiedAt()
- * .referenceDatasetId()
- * .tenantId()
- * ```
- */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [ComparativeListResponse]. */
- class Builder internal constructor() {
-
- private var id: JsonField? = null
- private var createdAt: JsonField? = null
- private var experimentsInfo: JsonField>? = null
- private var modifiedAt: JsonField? = null
- private var referenceDatasetId: JsonField? = null
- private var tenantId: JsonField? = null
- private var description: JsonField = JsonMissing.of()
- private var extra: JsonField = JsonMissing.of()
- private var feedbackStats: JsonField = JsonMissing.of()
- private var name: JsonField = JsonMissing.of()
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(comparativeListResponse: ComparativeListResponse) = apply {
- id = comparativeListResponse.id
- createdAt = comparativeListResponse.createdAt
- experimentsInfo = comparativeListResponse.experimentsInfo.map { it.toMutableList() }
- modifiedAt = comparativeListResponse.modifiedAt
- referenceDatasetId = comparativeListResponse.referenceDatasetId
- tenantId = comparativeListResponse.tenantId
- description = comparativeListResponse.description
- extra = comparativeListResponse.extra
- feedbackStats = comparativeListResponse.feedbackStats
- name = comparativeListResponse.name
- additionalProperties = comparativeListResponse.additionalProperties.toMutableMap()
- }
-
- fun id(id: String) = id(JsonField.of(id))
-
- /**
- * Sets [Builder.id] to an arbitrary JSON value.
- *
- * You should usually call [Builder.id] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun id(id: JsonField) = apply { this.id = id }
-
- fun createdAt(createdAt: OffsetDateTime) = createdAt(JsonField.of(createdAt))
-
- /**
- * Sets [Builder.createdAt] to an arbitrary JSON value.
- *
- * You should usually call [Builder.createdAt] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt }
-
- fun experimentsInfo(experimentsInfo: List) =
- experimentsInfo(JsonField.of(experimentsInfo))
-
- /**
- * Sets [Builder.experimentsInfo] to an arbitrary JSON value.
- *
- * You should usually call [Builder.experimentsInfo] with a well-typed
- * `List` value instead. This method is primarily for setting the
- * field to an undocumented or not yet supported value.
- */
- fun experimentsInfo(experimentsInfo: JsonField>) = apply {
- this.experimentsInfo = experimentsInfo.map { it.toMutableList() }
- }
-
- /**
- * Adds a single [SimpleExperimentInfo] to [Builder.experimentsInfo].
- *
- * @throws IllegalStateException if the field was previously set to a non-list.
- */
- fun addExperimentsInfo(experimentsInfo: SimpleExperimentInfo) = apply {
- this.experimentsInfo =
- (this.experimentsInfo ?: JsonField.of(mutableListOf())).also {
- checkKnown("experimentsInfo", it).add(experimentsInfo)
- }
- }
-
- fun modifiedAt(modifiedAt: OffsetDateTime) = modifiedAt(JsonField.of(modifiedAt))
-
- /**
- * Sets [Builder.modifiedAt] to an arbitrary JSON value.
- *
- * You should usually call [Builder.modifiedAt] with a well-typed [OffsetDateTime] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun modifiedAt(modifiedAt: JsonField) = apply {
- this.modifiedAt = modifiedAt
- }
-
- fun referenceDatasetId(referenceDatasetId: String) =
- referenceDatasetId(JsonField.of(referenceDatasetId))
-
- /**
- * Sets [Builder.referenceDatasetId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.referenceDatasetId] with a well-typed [String] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun referenceDatasetId(referenceDatasetId: JsonField) = apply {
- this.referenceDatasetId = referenceDatasetId
- }
-
- fun tenantId(tenantId: String) = tenantId(JsonField.of(tenantId))
-
- /**
- * Sets [Builder.tenantId] to an arbitrary JSON value.
- *
- * You should usually call [Builder.tenantId] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun tenantId(tenantId: JsonField) = apply { this.tenantId = tenantId }
-
- fun description(description: String?) = description(JsonField.ofNullable(description))
-
- /** Alias for calling [Builder.description] with `description.orElse(null)`. */
- fun description(description: Optional) = description(description.getOrNull())
-
- /**
- * Sets [Builder.description] to an arbitrary JSON value.
- *
- * You should usually call [Builder.description] with a well-typed [String] value instead.
- * This method is primarily for setting the field to an undocumented or not yet supported
- * value.
- */
- fun description(description: JsonField) = apply { this.description = description }
-
- fun extra(extra: Extra?) = extra(JsonField.ofNullable(extra))
-
- /** Alias for calling [Builder.extra] with `extra.orElse(null)`. */
- fun extra(extra: Optional) = extra(extra.getOrNull())
-
- /**
- * Sets [Builder.extra] to an arbitrary JSON value.
- *
- * You should usually call [Builder.extra] with a well-typed [Extra] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun extra(extra: JsonField) = apply { this.extra = extra }
-
- fun feedbackStats(feedbackStats: FeedbackStats?) =
- feedbackStats(JsonField.ofNullable(feedbackStats))
-
- /** Alias for calling [Builder.feedbackStats] with `feedbackStats.orElse(null)`. */
- fun feedbackStats(feedbackStats: Optional) =
- feedbackStats(feedbackStats.getOrNull())
-
- /**
- * Sets [Builder.feedbackStats] to an arbitrary JSON value.
- *
- * You should usually call [Builder.feedbackStats] with a well-typed [FeedbackStats] value
- * instead. This method is primarily for setting the field to an undocumented or not yet
- * supported value.
- */
- fun feedbackStats(feedbackStats: JsonField) = apply {
- this.feedbackStats = feedbackStats
- }
-
- fun name(name: String?) = name(JsonField.ofNullable(name))
-
- /** Alias for calling [Builder.name] with `name.orElse(null)`. */
- fun name(name: Optional) = name(name.getOrNull())
-
- /**
- * Sets [Builder.name] to an arbitrary JSON value.
- *
- * You should usually call [Builder.name] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun name(name: JsonField) = apply { this.name = name }
-
- 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 [ComparativeListResponse].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- *
- * The following fields are required:
- * ```java
- * .id()
- * .createdAt()
- * .experimentsInfo()
- * .modifiedAt()
- * .referenceDatasetId()
- * .tenantId()
- * ```
- *
- * @throws IllegalStateException if any required field is unset.
- */
- fun build(): ComparativeListResponse =
- ComparativeListResponse(
- checkRequired("id", id),
- checkRequired("createdAt", createdAt),
- checkRequired("experimentsInfo", experimentsInfo).map { it.toImmutable() },
- checkRequired("modifiedAt", modifiedAt),
- checkRequired("referenceDatasetId", referenceDatasetId),
- checkRequired("tenantId", tenantId),
- description,
- extra,
- feedbackStats,
- name,
- additionalProperties.toMutableMap(),
- )
- }
-
- private var validated: Boolean = false
-
- fun validate(): ComparativeListResponse = apply {
- if (validated) {
- return@apply
- }
-
- id()
- createdAt()
- experimentsInfo().forEach { it.validate() }
- modifiedAt()
- referenceDatasetId()
- tenantId()
- description()
- extra().ifPresent { it.validate() }
- feedbackStats().ifPresent { it.validate() }
- name()
- 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 (id.asKnown().isPresent) 1 else 0) +
- (if (createdAt.asKnown().isPresent) 1 else 0) +
- (experimentsInfo.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
- (if (modifiedAt.asKnown().isPresent) 1 else 0) +
- (if (referenceDatasetId.asKnown().isPresent) 1 else 0) +
- (if (tenantId.asKnown().isPresent) 1 else 0) +
- (if (description.asKnown().isPresent) 1 else 0) +
- (extra.asKnown().getOrNull()?.validity() ?: 0) +
- (feedbackStats.asKnown().getOrNull()?.validity() ?: 0) +
- (if (name.asKnown().isPresent) 1 else 0)
-
- class Extra
- @JsonCreator
- private constructor(
- @com.fasterxml.jackson.annotation.JsonValue
- private val additionalProperties: Map
- ) {
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map = additionalProperties
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /** Returns a mutable builder for constructing an instance of [Extra]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [Extra]. */
- class Builder internal constructor() {
-
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(extra: Extra) = apply {
- additionalProperties = extra.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) = 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 [Extra].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): Extra = Extra(additionalProperties.toImmutable())
- }
-
- private var validated: Boolean = false
-
- fun validate(): Extra = apply {
- if (validated) {
- return@apply
- }
-
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: LangChainInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object
- * recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is Extra && additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() = "Extra{additionalProperties=$additionalProperties}"
- }
-
- class FeedbackStats
- @JsonCreator
- private constructor(
- @com.fasterxml.jackson.annotation.JsonValue
- private val additionalProperties: Map
- ) {
-
- @JsonAnyGetter
- @ExcludeMissing
- fun _additionalProperties(): Map = additionalProperties
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- /** Returns a mutable builder for constructing an instance of [FeedbackStats]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [FeedbackStats]. */
- class Builder internal constructor() {
-
- private var additionalProperties: MutableMap = mutableMapOf()
-
- @JvmSynthetic
- internal fun from(feedbackStats: FeedbackStats) = apply {
- additionalProperties = feedbackStats.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) = 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 [FeedbackStats].
- *
- * Further updates to this [Builder] will not mutate the returned instance.
- */
- fun build(): FeedbackStats = FeedbackStats(additionalProperties.toImmutable())
- }
-
- private var validated: Boolean = false
-
- fun validate(): FeedbackStats = apply {
- if (validated) {
- return@apply
- }
-
- validated = true
- }
-
- fun isValid(): Boolean =
- try {
- validate()
- true
- } catch (e: LangChainInvalidDataException) {
- false
- }
-
- /**
- * Returns a score indicating how many valid values are contained in this object
- * recursively.
- *
- * Used for best match union deserialization.
- */
- @JvmSynthetic
- internal fun validity(): Int =
- additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is FeedbackStats && additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy { Objects.hash(additionalProperties) }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() = "FeedbackStats{additionalProperties=$additionalProperties}"
- }
-
- override fun equals(other: Any?): Boolean {
- if (this === other) {
- return true
- }
-
- return other is ComparativeListResponse &&
- id == other.id &&
- createdAt == other.createdAt &&
- experimentsInfo == other.experimentsInfo &&
- modifiedAt == other.modifiedAt &&
- referenceDatasetId == other.referenceDatasetId &&
- tenantId == other.tenantId &&
- description == other.description &&
- extra == other.extra &&
- feedbackStats == other.feedbackStats &&
- name == other.name &&
- additionalProperties == other.additionalProperties
- }
-
- private val hashCode: Int by lazy {
- Objects.hash(
- id,
- createdAt,
- experimentsInfo,
- modifiedAt,
- referenceDatasetId,
- tenantId,
- description,
- extra,
- feedbackStats,
- name,
- additionalProperties,
- )
- }
-
- override fun hashCode(): Int = hashCode
-
- override fun toString() =
- "ComparativeListResponse{id=$id, createdAt=$createdAt, experimentsInfo=$experimentsInfo, modifiedAt=$modifiedAt, referenceDatasetId=$referenceDatasetId, tenantId=$tenantId, description=$description, extra=$extra, feedbackStats=$feedbackStats, name=$name, additionalProperties=$additionalProperties}"
-}
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/group/GroupRunsResponse.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/group/GroupRunsResponse.kt
index 2cab7cc36..3ac47f55d 100644
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/group/GroupRunsResponse.kt
+++ b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/group/GroupRunsResponse.kt
@@ -219,7 +219,7 @@ private constructor(
* - latency_p50, latency_p99: aggregate latency stats across sessions
* - feedback_stats: weighted average feedback across sessions
*
- * Additional aggregate stats (from ExampleWithRunsGroup):
+ * Additional aggregate stats:
* - prompt_tokens, completion_tokens: separate token counts
* - prompt_cost, completion_cost: separate costs
* - error_rate: average error rate
diff --git a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/index/IndexCreateParams.kt b/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/index/IndexCreateParams.kt
deleted file mode 100644
index 870d7db50..000000000
--- a/langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/index/IndexCreateParams.kt
+++ /dev/null
@@ -1,408 +0,0 @@
-// File generated from our OpenAPI spec by Stainless.
-
-package com.langchain.smith.models.datasets.index
-
-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.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.http.Headers
-import com.langchain.smith.core.http.QueryParams
-import com.langchain.smith.errors.LangChainInvalidDataException
-import java.util.Collections
-import java.util.Objects
-import java.util.Optional
-import kotlin.jvm.optionals.getOrNull
-
-/** Index a dataset. */
-class IndexCreateParams
-private constructor(
- private val datasetId: String?,
- private val body: Body,
- private val additionalHeaders: Headers,
- private val additionalQueryParams: QueryParams,
-) : Params {
-
- fun datasetId(): Optional = Optional.ofNullable(datasetId)
-
- /**
- * @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
- * server responded with an unexpected value).
- */
- fun tag(): Optional = body.tag()
-
- /**
- * Returns the raw JSON value of [tag].
- *
- * Unlike [tag], this method doesn't throw if the JSON field has an unexpected type.
- */
- fun _tag(): JsonField = body._tag()
-
- fun _additionalBodyProperties(): Map = body._additionalProperties()
-
- /** Additional headers to send with the request. */
- fun _additionalHeaders(): Headers = additionalHeaders
-
- /** Additional query param to send with the request. */
- fun _additionalQueryParams(): QueryParams = additionalQueryParams
-
- fun toBuilder() = Builder().from(this)
-
- companion object {
-
- @JvmStatic fun none(): IndexCreateParams = builder().build()
-
- /** Returns a mutable builder for constructing an instance of [IndexCreateParams]. */
- @JvmStatic fun builder() = Builder()
- }
-
- /** A builder for [IndexCreateParams]. */
- class Builder internal constructor() {
-
- private var datasetId: String? = null
- private var body: Body.Builder = Body.builder()
- private var additionalHeaders: Headers.Builder = Headers.builder()
- private var additionalQueryParams: QueryParams.Builder = QueryParams.builder()
-
- @JvmSynthetic
- internal fun from(indexCreateParams: IndexCreateParams) = apply {
- datasetId = indexCreateParams.datasetId
- body = indexCreateParams.body.toBuilder()
- additionalHeaders = indexCreateParams.additionalHeaders.toBuilder()
- additionalQueryParams = indexCreateParams.additionalQueryParams.toBuilder()
- }
-
- fun datasetId(datasetId: String?) = apply { this.datasetId = datasetId }
-
- /** Alias for calling [Builder.datasetId] with `datasetId.orElse(null)`. */
- fun datasetId(datasetId: Optional) = datasetId(datasetId.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:
- * - [tag]
- */
- fun body(body: Body) = apply { this.body = body.toBuilder() }
-
- fun tag(tag: String?) = apply { body.tag(tag) }
-
- /** Alias for calling [Builder.tag] with `tag.orElse(null)`. */
- fun tag(tag: Optional) = tag(tag.getOrNull())
-
- /**
- * Sets [Builder.tag] to an arbitrary JSON value.
- *
- * You should usually call [Builder.tag] with a well-typed [String] value instead. This
- * method is primarily for setting the field to an undocumented or not yet supported value.
- */
- fun tag(tag: JsonField) = apply { body.tag(tag) }
-
- fun additionalBodyProperties(additionalBodyProperties: Map) = apply {
- body.additionalProperties(additionalBodyProperties)
- }
-
- fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
- body.putAdditionalProperty(key, value)
- }
-
- fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) =
- apply {
- 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)
- }
-
- fun additionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.clear()
- putAllAdditionalHeaders(additionalHeaders)
- }
-
- fun putAdditionalHeader(name: String, value: String) = apply {
- additionalHeaders.put(name, value)
- }
-
- fun putAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.put(name, values)
- }
-
- fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
-
- fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.putAll(additionalHeaders)
- }
-
- fun replaceAdditionalHeaders(name: String, value: String) = apply {
- additionalHeaders.replace(name, value)
- }
-
- fun replaceAdditionalHeaders(name: String, values: Iterable) = apply {
- additionalHeaders.replace(name, values)
- }
-
- fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
-
- fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply {
- this.additionalHeaders.replaceAll(additionalHeaders)
- }
-
- fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) }
-
- fun removeAllAdditionalHeaders(names: Set