Skip to content

Commit 703b77a

Browse files
feat(api): api update
1 parent 7d0f1d4 commit 703b77a

5 files changed

Lines changed: 101 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 100
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-2985c4b2fb2775c54111e322dbeffbe9efd950053c298ba04bd69932af35ac88.yml
3-
openapi_spec_hash: c0a61a9dd24496915cb693120b218101
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-99fbd44fd921bcd512c292d36b40675e9ce0b8f5f62433bc48310df2ed36b8b7.yml
3+
openapi_spec_hash: c61e3f15c867e0395cebbae0384d781d
44
config_hash: d847cdf0b10e3d2ae194df8fed4ae22a

langsmith-java-core/src/main/kotlin/com/langchain/smith/models/datasets/runs/RunCreateParams.kt

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ private constructor(
5353
*/
5454
fun comparativeExperimentId(): Optional<String> = body.comparativeExperimentId()
5555

56+
/**
57+
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
58+
* server responded with an unexpected value).
59+
*/
60+
fun exampleIds(): Optional<List<String>> = body.exampleIds()
61+
5662
/**
5763
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
5864
* server responded with an unexpected value).
@@ -104,6 +110,13 @@ private constructor(
104110
*/
105111
fun _comparativeExperimentId(): JsonField<String> = body._comparativeExperimentId()
106112

113+
/**
114+
* Returns the raw JSON value of [exampleIds].
115+
*
116+
* Unlike [exampleIds], this method doesn't throw if the JSON field has an unexpected type.
117+
*/
118+
fun _exampleIds(): JsonField<List<String>> = body._exampleIds()
119+
107120
/**
108121
* Returns the raw JSON value of [filters].
109122
*
@@ -205,9 +218,9 @@ private constructor(
205218
* Otherwise, it's more convenient to use the top-level setters instead:
206219
* - [sessionIds]
207220
* - [comparativeExperimentId]
221+
* - [exampleIds]
208222
* - [filters]
209223
* - [limit]
210-
* - [offset]
211224
* - etc.
212225
*/
213226
fun body(body: Body) = apply { this.body = body.toBuilder() }
@@ -252,6 +265,27 @@ private constructor(
252265
body.comparativeExperimentId(comparativeExperimentId)
253266
}
254267

268+
fun exampleIds(exampleIds: List<String>?) = apply { body.exampleIds(exampleIds) }
269+
270+
/** Alias for calling [Builder.exampleIds] with `exampleIds.orElse(null)`. */
271+
fun exampleIds(exampleIds: Optional<List<String>>) = exampleIds(exampleIds.getOrNull())
272+
273+
/**
274+
* Sets [Builder.exampleIds] to an arbitrary JSON value.
275+
*
276+
* You should usually call [Builder.exampleIds] with a well-typed `List<String>` value
277+
* instead. This method is primarily for setting the field to an undocumented or not yet
278+
* supported value.
279+
*/
280+
fun exampleIds(exampleIds: JsonField<List<String>>) = apply { body.exampleIds(exampleIds) }
281+
282+
/**
283+
* Adds a single [String] to [exampleIds].
284+
*
285+
* @throws IllegalStateException if the field was previously set to a non-list.
286+
*/
287+
fun addExampleId(exampleId: String) = apply { body.addExampleId(exampleId) }
288+
255289
fun filters(filters: Filters?) = apply { body.filters(filters) }
256290

257291
/** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
@@ -503,6 +537,7 @@ private constructor(
503537
private constructor(
504538
private val sessionIds: JsonField<List<String>>,
505539
private val comparativeExperimentId: JsonField<String>,
540+
private val exampleIds: JsonField<List<String>>,
506541
private val filters: JsonField<Filters>,
507542
private val limit: JsonField<Long>,
508543
private val offset: JsonField<Long>,
@@ -520,6 +555,9 @@ private constructor(
520555
@JsonProperty("comparative_experiment_id")
521556
@ExcludeMissing
522557
comparativeExperimentId: JsonField<String> = JsonMissing.of(),
558+
@JsonProperty("example_ids")
559+
@ExcludeMissing
560+
exampleIds: JsonField<List<String>> = JsonMissing.of(),
523561
@JsonProperty("filters") @ExcludeMissing filters: JsonField<Filters> = JsonMissing.of(),
524562
@JsonProperty("limit") @ExcludeMissing limit: JsonField<Long> = JsonMissing.of(),
525563
@JsonProperty("offset") @ExcludeMissing offset: JsonField<Long> = JsonMissing.of(),
@@ -531,6 +569,7 @@ private constructor(
531569
) : this(
532570
sessionIds,
533571
comparativeExperimentId,
572+
exampleIds,
534573
filters,
535574
limit,
536575
offset,
@@ -553,6 +592,12 @@ private constructor(
553592
fun comparativeExperimentId(): Optional<String> =
554593
comparativeExperimentId.getOptional("comparative_experiment_id")
555594

595+
/**
596+
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
597+
* the server responded with an unexpected value).
598+
*/
599+
fun exampleIds(): Optional<List<String>> = exampleIds.getOptional("example_ids")
600+
556601
/**
557602
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
558603
* the server responded with an unexpected value).
@@ -609,6 +654,15 @@ private constructor(
609654
@ExcludeMissing
610655
fun _comparativeExperimentId(): JsonField<String> = comparativeExperimentId
611656

657+
/**
658+
* Returns the raw JSON value of [exampleIds].
659+
*
660+
* Unlike [exampleIds], this method doesn't throw if the JSON field has an unexpected type.
661+
*/
662+
@JsonProperty("example_ids")
663+
@ExcludeMissing
664+
fun _exampleIds(): JsonField<List<String>> = exampleIds
665+
612666
/**
613667
* Returns the raw JSON value of [filters].
614668
*
@@ -683,6 +737,7 @@ private constructor(
683737

684738
private var sessionIds: JsonField<MutableList<String>>? = null
685739
private var comparativeExperimentId: JsonField<String> = JsonMissing.of()
740+
private var exampleIds: JsonField<MutableList<String>>? = null
686741
private var filters: JsonField<Filters> = JsonMissing.of()
687742
private var limit: JsonField<Long> = JsonMissing.of()
688743
private var offset: JsonField<Long> = JsonMissing.of()
@@ -695,6 +750,7 @@ private constructor(
695750
internal fun from(body: Body) = apply {
696751
sessionIds = body.sessionIds.map { it.toMutableList() }
697752
comparativeExperimentId = body.comparativeExperimentId
753+
exampleIds = body.exampleIds.map { it.toMutableList() }
698754
filters = body.filters
699755
limit = body.limit
700756
offset = body.offset
@@ -750,6 +806,34 @@ private constructor(
750806
this.comparativeExperimentId = comparativeExperimentId
751807
}
752808

809+
fun exampleIds(exampleIds: List<String>?) = exampleIds(JsonField.ofNullable(exampleIds))
810+
811+
/** Alias for calling [Builder.exampleIds] with `exampleIds.orElse(null)`. */
812+
fun exampleIds(exampleIds: Optional<List<String>>) = exampleIds(exampleIds.getOrNull())
813+
814+
/**
815+
* Sets [Builder.exampleIds] to an arbitrary JSON value.
816+
*
817+
* You should usually call [Builder.exampleIds] with a well-typed `List<String>` value
818+
* instead. This method is primarily for setting the field to an undocumented or not yet
819+
* supported value.
820+
*/
821+
fun exampleIds(exampleIds: JsonField<List<String>>) = apply {
822+
this.exampleIds = exampleIds.map { it.toMutableList() }
823+
}
824+
825+
/**
826+
* Adds a single [String] to [exampleIds].
827+
*
828+
* @throws IllegalStateException if the field was previously set to a non-list.
829+
*/
830+
fun addExampleId(exampleId: String) = apply {
831+
exampleIds =
832+
(exampleIds ?: JsonField.of(mutableListOf())).also {
833+
checkKnown("exampleIds", it).add(exampleId)
834+
}
835+
}
836+
753837
fun filters(filters: Filters?) = filters(JsonField.ofNullable(filters))
754838

755839
/** Alias for calling [Builder.filters] with `filters.orElse(null)`. */
@@ -871,6 +955,7 @@ private constructor(
871955
Body(
872956
checkRequired("sessionIds", sessionIds).map { it.toImmutable() },
873957
comparativeExperimentId,
958+
(exampleIds ?: JsonMissing.of()).map { it.toImmutable() },
874959
filters,
875960
limit,
876961
offset,
@@ -890,6 +975,7 @@ private constructor(
890975

891976
sessionIds()
892977
comparativeExperimentId()
978+
exampleIds()
893979
filters().ifPresent { it.validate() }
894980
limit()
895981
offset()
@@ -917,6 +1003,7 @@ private constructor(
9171003
internal fun validity(): Int =
9181004
(sessionIds.asKnown().getOrNull()?.size ?: 0) +
9191005
(if (comparativeExperimentId.asKnown().isPresent) 1 else 0) +
1006+
(exampleIds.asKnown().getOrNull()?.size ?: 0) +
9201007
(filters.asKnown().getOrNull()?.validity() ?: 0) +
9211008
(if (limit.asKnown().isPresent) 1 else 0) +
9221009
(if (offset.asKnown().isPresent) 1 else 0) +
@@ -932,6 +1019,7 @@ private constructor(
9321019
return other is Body &&
9331020
sessionIds == other.sessionIds &&
9341021
comparativeExperimentId == other.comparativeExperimentId &&
1022+
exampleIds == other.exampleIds &&
9351023
filters == other.filters &&
9361024
limit == other.limit &&
9371025
offset == other.offset &&
@@ -945,6 +1033,7 @@ private constructor(
9451033
Objects.hash(
9461034
sessionIds,
9471035
comparativeExperimentId,
1036+
exampleIds,
9481037
filters,
9491038
limit,
9501039
offset,
@@ -958,7 +1047,7 @@ private constructor(
9581047
override fun hashCode(): Int = hashCode
9591048

9601049
override fun toString() =
961-
"Body{sessionIds=$sessionIds, comparativeExperimentId=$comparativeExperimentId, filters=$filters, limit=$limit, offset=$offset, preview=$preview, sortParams=$sortParams, stream=$stream, additionalProperties=$additionalProperties}"
1050+
"Body{sessionIds=$sessionIds, comparativeExperimentId=$comparativeExperimentId, exampleIds=$exampleIds, filters=$filters, limit=$limit, offset=$offset, preview=$preview, sortParams=$sortParams, stream=$stream, additionalProperties=$additionalProperties}"
9621051
}
9631052

9641053
class Filters

langsmith-java-core/src/test/kotlin/com/langchain/smith/models/datasets/runs/RunCreateParamsTest.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package com.langchain.smith.models.datasets.runs
44

55
import com.langchain.smith.core.JsonValue
66
import com.langchain.smith.core.http.QueryParams
7+
import kotlin.jvm.optionals.getOrNull
78
import org.assertj.core.api.Assertions.assertThat
89
import org.junit.jupiter.api.Test
910

@@ -16,6 +17,7 @@ internal class RunCreateParamsTest {
1617
.format(RunCreateParams.Format.CSV)
1718
.addSessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
1819
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
20+
.addExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
1921
.filters(
2022
RunCreateParams.Filters.builder()
2123
.putAdditionalProperty("foo", JsonValue.from(listOf("string")))
@@ -55,6 +57,7 @@ internal class RunCreateParamsTest {
5557
.format(RunCreateParams.Format.CSV)
5658
.addSessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
5759
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
60+
.addExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
5861
.filters(
5962
RunCreateParams.Filters.builder()
6063
.putAdditionalProperty("foo", JsonValue.from(listOf("string")))
@@ -98,6 +101,7 @@ internal class RunCreateParamsTest {
98101
.format(RunCreateParams.Format.CSV)
99102
.addSessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
100103
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
104+
.addExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
101105
.filters(
102106
RunCreateParams.Filters.builder()
103107
.putAdditionalProperty("foo", JsonValue.from(listOf("string")))
@@ -119,6 +123,8 @@ internal class RunCreateParamsTest {
119123

120124
assertThat(body.sessionIds()).containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
121125
assertThat(body.comparativeExperimentId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
126+
assertThat(body.exampleIds().getOrNull())
127+
.containsExactly("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
122128
assertThat(body.filters())
123129
.contains(
124130
RunCreateParams.Filters.builder()

langsmith-java-core/src/test/kotlin/com/langchain/smith/services/async/datasets/RunServiceAsyncTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal class RunServiceAsyncTest {
3636
.format(RunCreateParams.Format.CSV)
3737
.addSessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3838
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
39+
.addExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3940
.filters(
4041
RunCreateParams.Filters.builder()
4142
.putAdditionalProperty("foo", JsonValue.from(listOf("string")))

langsmith-java-core/src/test/kotlin/com/langchain/smith/services/blocking/datasets/RunServiceTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal class RunServiceTest {
3636
.format(RunCreateParams.Format.CSV)
3737
.addSessionId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3838
.comparativeExperimentId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
39+
.addExampleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
3940
.filters(
4041
RunCreateParams.Filters.builder()
4142
.putAdditionalProperty("foo", JsonValue.from(listOf("string")))

0 commit comments

Comments
 (0)