Skip to content

Commit fd1fc58

Browse files
feat(api): api update
1 parent 0bc0d8c commit fd1fc58

7 files changed

Lines changed: 90 additions & 6 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: 123
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-31f3beb2e8b448db06506e4c6b3b32efb77851d3ebc1dbd4331e745282f170aa.yml
3-
openapi_spec_hash: 23ab12d03015d54d58074d0345a53cd7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/langsmith%2Flangsmith-api-6bc275ce282ae204d28252aeb4ba8125a77e2c8a06f140261974242f6a619a7e.yml
3+
openapi_spec_hash: fe9489bb794a60004ee5d10ff5582298
44
config_hash: 0147e25a53ffe0e5055ad212e0c985ba

langsmith-java-core/src/main/kotlin/com/langchain/smith/models/sandboxes/boxes/BoxCreateParams.kt

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ import java.util.Objects
2323
import java.util.Optional
2424
import kotlin.jvm.optionals.getOrNull
2525

26-
/** Create a new sandbox from a template. Optionally blocks until ready or timeout. */
26+
/**
27+
* Create a new sandbox. The snapshot may be identified by `snapshot_id` (UUID) or by
28+
* `snapshot_name` (tenant-scoped unique name); exactly one of `template_name`, `snapshot_id`, or
29+
* `snapshot_name` must be set. Optionally blocks until ready or timeout.
30+
*/
2731
class BoxCreateParams
2832
private constructor(
2933
private val body: Body,
@@ -67,6 +71,12 @@ private constructor(
6771
*/
6872
fun snapshotId(): Optional<String> = body.snapshotId()
6973

74+
/**
75+
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if the
76+
* server responded with an unexpected value).
77+
*/
78+
fun snapshotName(): Optional<String> = body.snapshotName()
79+
7080
/**
7181
* required for Kata path
7282
*
@@ -141,6 +151,13 @@ private constructor(
141151
*/
142152
fun _snapshotId(): JsonField<String> = body._snapshotId()
143153

154+
/**
155+
* Returns the raw JSON value of [snapshotName].
156+
*
157+
* Unlike [snapshotName], this method doesn't throw if the JSON field has an unexpected type.
158+
*/
159+
fun _snapshotName(): JsonField<String> = body._snapshotName()
160+
144161
/**
145162
* Returns the raw JSON value of [templateName].
146163
*
@@ -292,6 +309,19 @@ private constructor(
292309
*/
293310
fun snapshotId(snapshotId: JsonField<String>) = apply { body.snapshotId(snapshotId) }
294311

312+
fun snapshotName(snapshotName: String) = apply { body.snapshotName(snapshotName) }
313+
314+
/**
315+
* Sets [Builder.snapshotName] to an arbitrary JSON value.
316+
*
317+
* You should usually call [Builder.snapshotName] with a well-typed [String] value instead.
318+
* This method is primarily for setting the field to an undocumented or not yet supported
319+
* value.
320+
*/
321+
fun snapshotName(snapshotName: JsonField<String>) = apply {
322+
body.snapshotName(snapshotName)
323+
}
324+
295325
/** required for Kata path */
296326
fun templateName(templateName: String) = apply { body.templateName(templateName) }
297327

@@ -490,6 +520,7 @@ private constructor(
490520
private val name: JsonField<String>,
491521
private val proxyConfig: JsonField<ProxyConfig>,
492522
private val snapshotId: JsonField<String>,
523+
private val snapshotName: JsonField<String>,
493524
private val templateName: JsonField<String>,
494525
private val timeout: JsonField<Long>,
495526
private val ttlSeconds: JsonField<Long>,
@@ -514,6 +545,9 @@ private constructor(
514545
@JsonProperty("snapshot_id")
515546
@ExcludeMissing
516547
snapshotId: JsonField<String> = JsonMissing.of(),
548+
@JsonProperty("snapshot_name")
549+
@ExcludeMissing
550+
snapshotName: JsonField<String> = JsonMissing.of(),
517551
@JsonProperty("template_name")
518552
@ExcludeMissing
519553
templateName: JsonField<String> = JsonMissing.of(),
@@ -532,6 +566,7 @@ private constructor(
532566
name,
533567
proxyConfig,
534568
snapshotId,
569+
snapshotName,
535570
templateName,
536571
timeout,
537572
ttlSeconds,
@@ -576,6 +611,12 @@ private constructor(
576611
*/
577612
fun snapshotId(): Optional<String> = snapshotId.getOptional("snapshot_id")
578613

614+
/**
615+
* @throws LangChainInvalidDataException if the JSON field has an unexpected type (e.g. if
616+
* the server responded with an unexpected value).
617+
*/
618+
fun snapshotName(): Optional<String> = snapshotName.getOptional("snapshot_name")
619+
579620
/**
580621
* required for Kata path
581622
*
@@ -660,6 +701,16 @@ private constructor(
660701
@ExcludeMissing
661702
fun _snapshotId(): JsonField<String> = snapshotId
662703

704+
/**
705+
* Returns the raw JSON value of [snapshotName].
706+
*
707+
* Unlike [snapshotName], this method doesn't throw if the JSON field has an unexpected
708+
* type.
709+
*/
710+
@JsonProperty("snapshot_name")
711+
@ExcludeMissing
712+
fun _snapshotName(): JsonField<String> = snapshotName
713+
663714
/**
664715
* Returns the raw JSON value of [templateName].
665716
*
@@ -728,6 +779,7 @@ private constructor(
728779
private var name: JsonField<String> = JsonMissing.of()
729780
private var proxyConfig: JsonField<ProxyConfig> = JsonMissing.of()
730781
private var snapshotId: JsonField<String> = JsonMissing.of()
782+
private var snapshotName: JsonField<String> = JsonMissing.of()
731783
private var templateName: JsonField<String> = JsonMissing.of()
732784
private var timeout: JsonField<Long> = JsonMissing.of()
733785
private var ttlSeconds: JsonField<Long> = JsonMissing.of()
@@ -743,6 +795,7 @@ private constructor(
743795
name = body.name
744796
proxyConfig = body.proxyConfig
745797
snapshotId = body.snapshotId
798+
snapshotName = body.snapshotName
746799
templateName = body.templateName
747800
timeout = body.timeout
748801
ttlSeconds = body.ttlSeconds
@@ -824,6 +877,19 @@ private constructor(
824877
*/
825878
fun snapshotId(snapshotId: JsonField<String>) = apply { this.snapshotId = snapshotId }
826879

880+
fun snapshotName(snapshotName: String) = snapshotName(JsonField.of(snapshotName))
881+
882+
/**
883+
* Sets [Builder.snapshotName] to an arbitrary JSON value.
884+
*
885+
* You should usually call [Builder.snapshotName] with a well-typed [String] value
886+
* instead. This method is primarily for setting the field to an undocumented or not yet
887+
* supported value.
888+
*/
889+
fun snapshotName(snapshotName: JsonField<String>) = apply {
890+
this.snapshotName = snapshotName
891+
}
892+
827893
/** required for Kata path */
828894
fun templateName(templateName: String) = templateName(JsonField.of(templateName))
829895

@@ -916,6 +982,7 @@ private constructor(
916982
name,
917983
proxyConfig,
918984
snapshotId,
985+
snapshotName,
919986
templateName,
920987
timeout,
921988
ttlSeconds,
@@ -938,6 +1005,7 @@ private constructor(
9381005
name()
9391006
proxyConfig().ifPresent { it.validate() }
9401007
snapshotId()
1008+
snapshotName()
9411009
templateName()
9421010
timeout()
9431011
ttlSeconds()
@@ -968,6 +1036,7 @@ private constructor(
9681036
(if (name.asKnown().isPresent) 1 else 0) +
9691037
(proxyConfig.asKnown().getOrNull()?.validity() ?: 0) +
9701038
(if (snapshotId.asKnown().isPresent) 1 else 0) +
1039+
(if (snapshotName.asKnown().isPresent) 1 else 0) +
9711040
(if (templateName.asKnown().isPresent) 1 else 0) +
9721041
(if (timeout.asKnown().isPresent) 1 else 0) +
9731042
(if (ttlSeconds.asKnown().isPresent) 1 else 0) +
@@ -986,6 +1055,7 @@ private constructor(
9861055
name == other.name &&
9871056
proxyConfig == other.proxyConfig &&
9881057
snapshotId == other.snapshotId &&
1058+
snapshotName == other.snapshotName &&
9891059
templateName == other.templateName &&
9901060
timeout == other.timeout &&
9911061
ttlSeconds == other.ttlSeconds &&
@@ -1002,6 +1072,7 @@ private constructor(
10021072
name,
10031073
proxyConfig,
10041074
snapshotId,
1075+
snapshotName,
10051076
templateName,
10061077
timeout,
10071078
ttlSeconds,
@@ -1014,7 +1085,7 @@ private constructor(
10141085
override fun hashCode(): Int = hashCode
10151086

10161087
override fun toString() =
1017-
"Body{fsCapacityBytes=$fsCapacityBytes, idleTtlSeconds=$idleTtlSeconds, memBytes=$memBytes, name=$name, proxyConfig=$proxyConfig, snapshotId=$snapshotId, templateName=$templateName, timeout=$timeout, ttlSeconds=$ttlSeconds, vcpus=$vcpus, waitForReady=$waitForReady, additionalProperties=$additionalProperties}"
1088+
"Body{fsCapacityBytes=$fsCapacityBytes, idleTtlSeconds=$idleTtlSeconds, memBytes=$memBytes, name=$name, proxyConfig=$proxyConfig, snapshotId=$snapshotId, snapshotName=$snapshotName, templateName=$templateName, timeout=$timeout, ttlSeconds=$ttlSeconds, vcpus=$vcpus, waitForReady=$waitForReady, additionalProperties=$additionalProperties}"
10181089
}
10191090

10201091
class ProxyConfig

langsmith-java-core/src/main/kotlin/com/langchain/smith/services/async/sandboxes/BoxServiceAsync.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ interface BoxServiceAsync {
4141
*/
4242
fun withOptions(modifier: Consumer<ClientOptions.Builder>): BoxServiceAsync
4343

44-
/** Create a new sandbox from a template. Optionally blocks until ready or timeout. */
44+
/**
45+
* Create a new sandbox. The snapshot may be identified by `snapshot_id` (UUID) or by
46+
* `snapshot_name` (tenant-scoped unique name); exactly one of `template_name`, `snapshot_id`,
47+
* or `snapshot_name` must be set. Optionally blocks until ready or timeout.
48+
*/
4549
fun create(): CompletableFuture<BoxCreateResponse> = create(BoxCreateParams.none())
4650

4751
/** @see create */

langsmith-java-core/src/main/kotlin/com/langchain/smith/services/blocking/sandboxes/BoxService.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ interface BoxService {
4141
*/
4242
fun withOptions(modifier: Consumer<ClientOptions.Builder>): BoxService
4343

44-
/** Create a new sandbox from a template. Optionally blocks until ready or timeout. */
44+
/**
45+
* Create a new sandbox. The snapshot may be identified by `snapshot_id` (UUID) or by
46+
* `snapshot_name` (tenant-scoped unique name); exactly one of `template_name`, `snapshot_id`,
47+
* or `snapshot_name` must be set. Optionally blocks until ready or timeout.
48+
*/
4549
fun create(): BoxCreateResponse = create(BoxCreateParams.none())
4650

4751
/** @see create */

langsmith-java-core/src/test/kotlin/com/langchain/smith/models/sandboxes/boxes/BoxCreateParamsTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ internal class BoxCreateParamsTest {
4242
.build()
4343
)
4444
.snapshotId("snapshot_id")
45+
.snapshotName("snapshot_name")
4546
.templateName("template_name")
4647
.timeout(0L)
4748
.ttlSeconds(0L)
@@ -88,6 +89,7 @@ internal class BoxCreateParamsTest {
8889
.build()
8990
)
9091
.snapshotId("snapshot_id")
92+
.snapshotName("snapshot_name")
9193
.templateName("template_name")
9294
.timeout(0L)
9395
.ttlSeconds(0L)
@@ -130,6 +132,7 @@ internal class BoxCreateParamsTest {
130132
.build()
131133
)
132134
assertThat(body.snapshotId()).contains("snapshot_id")
135+
assertThat(body.snapshotName()).contains("snapshot_name")
133136
assertThat(body.templateName()).contains("template_name")
134137
assertThat(body.timeout()).contains(0L)
135138
assertThat(body.ttlSeconds()).contains(0L)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ internal class BoxServiceAsyncTest {
6262
.build()
6363
)
6464
.snapshotId("snapshot_id")
65+
.snapshotName("snapshot_name")
6566
.templateName("template_name")
6667
.timeout(0L)
6768
.ttlSeconds(0L)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ internal class BoxServiceTest {
6262
.build()
6363
)
6464
.snapshotId("snapshot_id")
65+
.snapshotName("snapshot_name")
6566
.templateName("template_name")
6667
.timeout(0L)
6768
.ttlSeconds(0L)

0 commit comments

Comments
 (0)