Skip to content

Commit cd9f555

Browse files
feat(api): api update
1 parent af93e09 commit cd9f555

7 files changed

Lines changed: 63 additions & 5 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: 102
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-e618b926237d170177f03ab5d24ee6dc0b1557be81d2ea8d1967a3cc041f739b.yml
3-
openapi_spec_hash: ae6d82f6dea4693e9951ab684049ab4e
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-d4b2278e9baa17ef476065b3b53a2012bcfd257915aa38991d2ecdfab1595766.yml
3+
openapi_spec_hash: 90898c9254e266bfde382341368d3793
44
config_hash: 787a12876983a14bce67ed57899e4a94

langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitRetrieveParams.kt

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ private constructor(
2424
private val repo: String,
2525
private val commit: String?,
2626
private val getExamples: Boolean?,
27+
private val include: String?,
2728
private val includeModel: Boolean?,
2829
private val isView: Boolean?,
2930
private val additionalHeaders: Headers,
@@ -38,6 +39,10 @@ private constructor(
3839

3940
fun getExamples(): Optional<Boolean> = Optional.ofNullable(getExamples)
4041

42+
/** Comma-separated list of optional fields: "model", "is_draft" */
43+
fun include(): Optional<String> = Optional.ofNullable(include)
44+
45+
/** Deprecated: use Include instead */
4146
fun includeModel(): Optional<Boolean> = Optional.ofNullable(includeModel)
4247

4348
fun isView(): Optional<Boolean> = Optional.ofNullable(isView)
@@ -71,6 +76,7 @@ private constructor(
7176
private var repo: String? = null
7277
private var commit: String? = null
7378
private var getExamples: Boolean? = null
79+
private var include: String? = null
7480
private var includeModel: Boolean? = null
7581
private var isView: Boolean? = null
7682
private var additionalHeaders: Headers.Builder = Headers.builder()
@@ -82,6 +88,7 @@ private constructor(
8288
repo = commitRetrieveParams.repo
8389
commit = commitRetrieveParams.commit
8490
getExamples = commitRetrieveParams.getExamples
91+
include = commitRetrieveParams.include
8592
includeModel = commitRetrieveParams.includeModel
8693
isView = commitRetrieveParams.isView
8794
additionalHeaders = commitRetrieveParams.additionalHeaders.toBuilder()
@@ -109,6 +116,13 @@ private constructor(
109116
/** Alias for calling [Builder.getExamples] with `getExamples.orElse(null)`. */
110117
fun getExamples(getExamples: Optional<Boolean>) = getExamples(getExamples.getOrNull())
111118

119+
/** Comma-separated list of optional fields: "model", "is_draft" */
120+
fun include(include: String?) = apply { this.include = include }
121+
122+
/** Alias for calling [Builder.include] with `include.orElse(null)`. */
123+
fun include(include: Optional<String>) = include(include.getOrNull())
124+
125+
/** Deprecated: use Include instead */
112126
fun includeModel(includeModel: Boolean?) = apply { this.includeModel = includeModel }
113127

114128
/**
@@ -250,6 +264,7 @@ private constructor(
250264
checkRequired("repo", repo),
251265
commit,
252266
getExamples,
267+
include,
253268
includeModel,
254269
isView,
255270
additionalHeaders.build(),
@@ -271,6 +286,7 @@ private constructor(
271286
QueryParams.builder()
272287
.apply {
273288
getExamples?.let { put("get_examples", it.toString()) }
289+
include?.let { put("include", it) }
274290
includeModel?.let { put("include_model", it.toString()) }
275291
isView?.let { put("is_view", it.toString()) }
276292
putAll(additionalQueryParams)
@@ -287,6 +303,7 @@ private constructor(
287303
repo == other.repo &&
288304
commit == other.commit &&
289305
getExamples == other.getExamples &&
306+
include == other.include &&
290307
includeModel == other.includeModel &&
291308
isView == other.isView &&
292309
additionalHeaders == other.additionalHeaders &&
@@ -299,12 +316,13 @@ private constructor(
299316
repo,
300317
commit,
301318
getExamples,
319+
include,
302320
includeModel,
303321
isView,
304322
additionalHeaders,
305323
additionalQueryParams,
306324
)
307325

308326
override fun toString() =
309-
"CommitRetrieveParams{owner=$owner, repo=$repo, commit=$commit, getExamples=$getExamples, includeModel=$includeModel, isView=$isView, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
327+
"CommitRetrieveParams{owner=$owner, repo=$repo, commit=$commit, getExamples=$getExamples, include=$include, includeModel=$includeModel, isView=$isView, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}"
310328
}

langsmith-java-core/src/main/kotlin/com/langchain/smith/models/commits/CommitRetrieveResponse.kt

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class CommitRetrieveResponse
2323
private constructor(
2424
private val commitHash: JsonField<String>,
2525
private val examples: JsonField<List<Example>>,
26+
private val isDraft: JsonField<Boolean>,
2627
private val manifest: JsonValue,
2728
private val modelConfig: JsonValue,
2829
private val modelProvider: JsonField<String>,
@@ -37,12 +38,13 @@ private constructor(
3738
@JsonProperty("examples")
3839
@ExcludeMissing
3940
examples: JsonField<List<Example>> = JsonMissing.of(),
41+
@JsonProperty("is_draft") @ExcludeMissing isDraft: JsonField<Boolean> = JsonMissing.of(),
4042
@JsonProperty("manifest") @ExcludeMissing manifest: JsonValue = JsonMissing.of(),
4143
@JsonProperty("model_config") @ExcludeMissing modelConfig: JsonValue = JsonMissing.of(),
4244
@JsonProperty("model_provider")
4345
@ExcludeMissing
4446
modelProvider: JsonField<String> = JsonMissing.of(),
45-
) : this(commitHash, examples, manifest, modelConfig, modelProvider, mutableMapOf())
47+
) : this(commitHash, examples, isDraft, manifest, modelConfig, modelProvider, mutableMapOf())
4648

4749
/**
4850
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
@@ -56,6 +58,12 @@ private constructor(
5658
*/
5759
fun examples(): Optional<List<Example>> = examples.getOptional("examples")
5860

61+
/**
62+
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
63+
* server responded with an unexpected value).
64+
*/
65+
fun isDraft(): Optional<Boolean> = isDraft.getOptional("is_draft")
66+
5967
/**
6068
* This arbitrary value can be deserialized into a custom type using the `convert` method:
6169
* ```java
@@ -92,6 +100,13 @@ private constructor(
92100
*/
93101
@JsonProperty("examples") @ExcludeMissing fun _examples(): JsonField<List<Example>> = examples
94102

103+
/**
104+
* Returns the raw JSON value of [isDraft].
105+
*
106+
* Unlike [isDraft], this method doesn't throw if the JSON field has an unexpected type.
107+
*/
108+
@JsonProperty("is_draft") @ExcludeMissing fun _isDraft(): JsonField<Boolean> = isDraft
109+
95110
/**
96111
* Returns the raw JSON value of [modelProvider].
97112
*
@@ -124,6 +139,7 @@ private constructor(
124139

125140
private var commitHash: JsonField<String> = JsonMissing.of()
126141
private var examples: JsonField<MutableList<Example>>? = null
142+
private var isDraft: JsonField<Boolean> = JsonMissing.of()
127143
private var manifest: JsonValue = JsonMissing.of()
128144
private var modelConfig: JsonValue = JsonMissing.of()
129145
private var modelProvider: JsonField<String> = JsonMissing.of()
@@ -133,6 +149,7 @@ private constructor(
133149
internal fun from(commitRetrieveResponse: CommitRetrieveResponse) = apply {
134150
commitHash = commitRetrieveResponse.commitHash
135151
examples = commitRetrieveResponse.examples.map { it.toMutableList() }
152+
isDraft = commitRetrieveResponse.isDraft
136153
manifest = commitRetrieveResponse.manifest
137154
modelConfig = commitRetrieveResponse.modelConfig
138155
modelProvider = commitRetrieveResponse.modelProvider
@@ -175,6 +192,16 @@ private constructor(
175192
}
176193
}
177194

195+
fun isDraft(isDraft: Boolean) = isDraft(JsonField.of(isDraft))
196+
197+
/**
198+
* Sets [Builder.isDraft] to an arbitrary JSON value.
199+
*
200+
* You should usually call [Builder.isDraft] with a well-typed [Boolean] value instead. This
201+
* method is primarily for setting the field to an undocumented or not yet supported value.
202+
*/
203+
fun isDraft(isDraft: JsonField<Boolean>) = apply { this.isDraft = isDraft }
204+
178205
fun manifest(manifest: JsonValue) = apply { this.manifest = manifest }
179206

180207
fun modelConfig(modelConfig: JsonValue) = apply { this.modelConfig = modelConfig }
@@ -220,6 +247,7 @@ private constructor(
220247
CommitRetrieveResponse(
221248
commitHash,
222249
(examples ?: JsonMissing.of()).map { it.toImmutable() },
250+
isDraft,
223251
manifest,
224252
modelConfig,
225253
modelProvider,
@@ -236,6 +264,7 @@ private constructor(
236264

237265
commitHash()
238266
examples().ifPresent { it.forEach { it.validate() } }
267+
isDraft()
239268
modelProvider()
240269
validated = true
241270
}
@@ -257,6 +286,7 @@ private constructor(
257286
internal fun validity(): Int =
258287
(if (commitHash.asKnown().isPresent) 1 else 0) +
259288
(examples.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
289+
(if (isDraft.asKnown().isPresent) 1 else 0) +
260290
(if (modelProvider.asKnown().isPresent) 1 else 0)
261291

262292
class Example
@@ -513,6 +543,7 @@ private constructor(
513543
return other is CommitRetrieveResponse &&
514544
commitHash == other.commitHash &&
515545
examples == other.examples &&
546+
isDraft == other.isDraft &&
516547
manifest == other.manifest &&
517548
modelConfig == other.modelConfig &&
518549
modelProvider == other.modelProvider &&
@@ -523,6 +554,7 @@ private constructor(
523554
Objects.hash(
524555
commitHash,
525556
examples,
557+
isDraft,
526558
manifest,
527559
modelConfig,
528560
modelProvider,
@@ -533,5 +565,5 @@ private constructor(
533565
override fun hashCode(): Int = hashCode
534566

535567
override fun toString() =
536-
"CommitRetrieveResponse{commitHash=$commitHash, examples=$examples, manifest=$manifest, modelConfig=$modelConfig, modelProvider=$modelProvider, additionalProperties=$additionalProperties}"
568+
"CommitRetrieveResponse{commitHash=$commitHash, examples=$examples, isDraft=$isDraft, manifest=$manifest, modelConfig=$modelConfig, modelProvider=$modelProvider, additionalProperties=$additionalProperties}"
537569
}

langsmith-java-core/src/test/kotlin/com/langchain/smith/models/commits/CommitRetrieveParamsTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal class CommitRetrieveParamsTest {
1515
.repo("repo")
1616
.commit("commit")
1717
.getExamples(true)
18+
.include("include")
1819
.includeModel(true)
1920
.isView(true)
2021
.build()
@@ -40,6 +41,7 @@ internal class CommitRetrieveParamsTest {
4041
.repo("repo")
4142
.commit("commit")
4243
.getExamples(true)
44+
.include("include")
4345
.includeModel(true)
4446
.isView(true)
4547
.build()
@@ -50,6 +52,7 @@ internal class CommitRetrieveParamsTest {
5052
.isEqualTo(
5153
QueryParams.builder()
5254
.put("get_examples", "true")
55+
.put("include", "include")
5356
.put("include_model", "true")
5457
.put("is_view", "true")
5558
.build()

langsmith-java-core/src/test/kotlin/com/langchain/smith/models/commits/CommitRetrieveResponseTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ internal class CommitRetrieveResponseTest {
2525
.startTime("start_time")
2626
.build()
2727
)
28+
.isDraft(true)
2829
.manifest(JsonValue.from(mapOf<String, Any>()))
2930
.modelConfig(JsonValue.from(mapOf<String, Any>()))
3031
.modelProvider("model_provider")
@@ -41,6 +42,7 @@ internal class CommitRetrieveResponseTest {
4142
.startTime("start_time")
4243
.build()
4344
)
45+
assertThat(commitRetrieveResponse.isDraft()).contains(true)
4446
assertThat(commitRetrieveResponse._manifest())
4547
.isEqualTo(JsonValue.from(mapOf<String, Any>()))
4648
assertThat(commitRetrieveResponse._modelConfig())
@@ -63,6 +65,7 @@ internal class CommitRetrieveResponseTest {
6365
.startTime("start_time")
6466
.build()
6567
)
68+
.isDraft(true)
6669
.manifest(JsonValue.from(mapOf<String, Any>()))
6770
.modelConfig(JsonValue.from(mapOf<String, Any>()))
6871
.modelProvider("model_provider")

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ internal class CommitServiceAsyncTest {
5656
.repo("repo")
5757
.commit("commit")
5858
.getExamples(true)
59+
.include("include")
5960
.includeModel(true)
6061
.isView(true)
6162
.build()

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ internal class CommitServiceTest {
5555
.repo("repo")
5656
.commit("commit")
5757
.getExamples(true)
58+
.include("include")
5859
.includeModel(true)
5960
.isView(true)
6061
.build()

0 commit comments

Comments
 (0)