langsmith 0.8.11 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_openapi_client/resources/issues.d.ts +6 -0
- package/dist/_openapi_client/resources/online-evaluators.cjs +2 -2
- package/dist/_openapi_client/resources/online-evaluators.d.ts +7 -2
- package/dist/_openapi_client/resources/online-evaluators.js +2 -2
- package/dist/_openapi_client/resources/public/runs.d.ts +1 -1
- package/dist/_openapi_client/resources/sandboxes/boxes.cjs +2 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +25 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.js +2 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +7 -2
- package/dist/_openapi_client/resources/sandboxes/sandboxes.js +1 -1
- package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +12 -2
- package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +25 -3
- package/dist/_openapi_client/resources/sandboxes/snapshots.js +12 -2
- package/dist/_openapi_client/resources/threads.cjs +1 -1
- package/dist/_openapi_client/resources/threads.d.ts +26 -1
- package/dist/_openapi_client/resources/threads.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/run_trees.cjs +19 -2
- package/dist/run_trees.d.ts +12 -0
- package/dist/run_trees.js +19 -2
- package/dist/sandbox/client.cjs +55 -7
- package/dist/sandbox/client.d.ts +27 -1
- package/dist/sandbox/client.js +55 -7
- package/dist/sandbox/errors.cjs +17 -6
- package/dist/sandbox/errors.d.ts +12 -5
- package/dist/sandbox/errors.js +15 -5
- package/dist/sandbox/index.cjs +2 -1
- package/dist/sandbox/index.d.ts +2 -2
- package/dist/sandbox/index.js +1 -1
- package/dist/sandbox/sandbox.cjs +27 -1
- package/dist/sandbox/sandbox.d.ts +25 -1
- package/dist/sandbox/sandbox.js +28 -2
- package/dist/sandbox/types.d.ts +35 -0
- package/dist/sandbox/ws_execute.cjs +7 -3
- package/dist/sandbox/ws_execute.js +8 -4
- package/dist/utils/env.cjs +18 -7
- package/dist/utils/env.js +18 -7
- package/dist/wrappers/openai_agents.cjs +2 -1
- package/dist/wrappers/openai_agents.js +2 -1
- package/package.json +1 -1
|
@@ -21,6 +21,12 @@ export type IssuesOffsetPaginationIssues = OffsetPaginationIssues<Issue>;
|
|
|
21
21
|
export interface Issue {
|
|
22
22
|
id?: string;
|
|
23
23
|
actions?: unknown;
|
|
24
|
+
auto_resolution_evidence?: unknown;
|
|
25
|
+
/**
|
|
26
|
+
* Nil unless eligible: "auto_close" or "prompt". Evidence carries the deciding
|
|
27
|
+
* gate.
|
|
28
|
+
*/
|
|
29
|
+
auto_resolution_state?: string;
|
|
24
30
|
created_at?: string;
|
|
25
31
|
description?: string;
|
|
26
32
|
first_seen_at?: string;
|
|
@@ -60,8 +60,8 @@ class OnlineEvaluators extends resource_js_1.APIResource {
|
|
|
60
60
|
/**
|
|
61
61
|
* Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
|
|
62
62
|
* evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
|
|
63
|
-
* session_id, or dataset_id is required. resource_id, type,
|
|
64
|
-
* be supplied with group_by to narrow listing aggregations.
|
|
63
|
+
* session_id, or dataset_id is required. resource_id, type, feedback_key, and
|
|
64
|
+
* tag_value_id may be supplied with group_by to narrow listing aggregations.
|
|
65
65
|
*/
|
|
66
66
|
spend(query, options) {
|
|
67
67
|
return this._client.get('/api/v1/platform/evaluators/spend', { query, ...options });
|
|
@@ -34,8 +34,8 @@ export declare class OnlineEvaluators extends APIResource {
|
|
|
34
34
|
/**
|
|
35
35
|
* Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
|
|
36
36
|
* evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
|
|
37
|
-
* session_id, or dataset_id is required. resource_id, type,
|
|
38
|
-
* be supplied with group_by to narrow listing aggregations.
|
|
37
|
+
* session_id, or dataset_id is required. resource_id, type, feedback_key, and
|
|
38
|
+
* tag_value_id may be supplied with group_by to narrow listing aggregations.
|
|
39
39
|
*/
|
|
40
40
|
spend(query: OnlineEvaluatorSpendParams, options?: RequestOptions): APIPromise<GetOnlineEvaluatorSpendResponse>;
|
|
41
41
|
}
|
|
@@ -286,6 +286,11 @@ export interface OnlineEvaluatorSpendParams {
|
|
|
286
286
|
* Filter to a specific project (UUID). Mutually exclusive with group_by.
|
|
287
287
|
*/
|
|
288
288
|
session_id?: string;
|
|
289
|
+
/**
|
|
290
|
+
* Filter grouped results to evaluators, projects, or datasets tagged with all
|
|
291
|
+
* supplied tag value IDs. Only valid with group_by.
|
|
292
|
+
*/
|
|
293
|
+
tag_value_id?: Array<string>;
|
|
289
294
|
/**
|
|
290
295
|
* Filter grouped results by evaluator type: 'llm' or 'code'. Only valid with
|
|
291
296
|
* group_by.
|
|
@@ -57,8 +57,8 @@ export class OnlineEvaluators extends APIResource {
|
|
|
57
57
|
/**
|
|
58
58
|
* Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
|
|
59
59
|
* evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
|
|
60
|
-
* session_id, or dataset_id is required. resource_id, type,
|
|
61
|
-
* be supplied with group_by to narrow listing aggregations.
|
|
60
|
+
* session_id, or dataset_id is required. resource_id, type, feedback_key, and
|
|
61
|
+
* tag_value_id may be supplied with group_by to narrow listing aggregations.
|
|
62
62
|
*/
|
|
63
63
|
spend(query, options) {
|
|
64
64
|
return this._client.get('/api/v1/platform/evaluators/spend', { query, ...options });
|
|
@@ -69,7 +69,7 @@ export interface RunQueryParams {
|
|
|
69
69
|
*/
|
|
70
70
|
selects?: Array<'ID' | 'NAME' | 'RUN_TYPE' | 'STATUS' | 'START_TIME' | 'END_TIME' | 'LATENCY_SECONDS' | 'FIRST_TOKEN_TIME' | 'ERROR' | 'ERROR_PREVIEW' | 'EXTRA' | 'METADATA' | 'INPUTS_PREVIEW' | 'OUTPUTS_PREVIEW' | 'PARENT_RUN_ID' | 'PARENT_RUN_IDS' | 'PROJECT_ID' | 'TRACE_ID' | 'THREAD_ID' | 'DOTTED_ORDER' | 'IS_ROOT' | 'REFERENCE_DATASET_ID' | 'TOTAL_TOKENS' | 'PROMPT_TOKENS' | 'COMPLETION_TOKENS' | 'TOTAL_COST' | 'PROMPT_COST' | 'COMPLETION_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'PRICE_MODEL_ID' | 'TAGS' | 'THREAD_EVALUATION_TIME' | 'FEEDBACK_STATS'>;
|
|
71
71
|
/**
|
|
72
|
-
* Header param: application/json
|
|
72
|
+
* Header param: application/json or text/event-stream
|
|
73
73
|
*/
|
|
74
74
|
Accept?: string;
|
|
75
75
|
}
|
|
@@ -10,6 +10,8 @@ class Boxes extends resource_js_1.APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
|
|
12
12
|
* `snapshot_name`; if neither is provided, the server uses the default snapshot.
|
|
13
|
+
* `snapshot_name` accepts a Docker-style `name` or `name:tag` reference (a bare
|
|
14
|
+
* name resolves to `name:latest`).
|
|
13
15
|
*/
|
|
14
16
|
create(body, options) {
|
|
15
17
|
return this._client.post('/api/v2/sandboxes/boxes', { body, ...options });
|
|
@@ -6,6 +6,8 @@ export declare class Boxes extends APIResource {
|
|
|
6
6
|
/**
|
|
7
7
|
* Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
|
|
8
8
|
* `snapshot_name`; if neither is provided, the server uses the default snapshot.
|
|
9
|
+
* `snapshot_name` accepts a Docker-style `name` or `name:tag` reference (a bare
|
|
10
|
+
* name resolves to `name:latest`).
|
|
9
11
|
*/
|
|
10
12
|
create(body: BoxCreateParams, options?: RequestOptions): APIPromise<SandboxesAPI.SandboxResponse>;
|
|
11
13
|
/**
|
|
@@ -72,6 +74,12 @@ export interface BoxCreateParams {
|
|
|
72
74
|
labels?: {
|
|
73
75
|
[key: string]: string;
|
|
74
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* Memory for the sandbox, in bytes. Memory is tied to CPU at 4 GiB per vCPU: omit
|
|
79
|
+
* it and it follows that ratio; set it and it must stay within 50% of the ratio
|
|
80
|
+
* for the requested CPU, so a 1 vCPU sandbox accepts 2-6 GiB. Setting memory
|
|
81
|
+
* without CPU derives the CPU from the same ratio. Maximum 64 GiB.
|
|
82
|
+
*/
|
|
75
83
|
mem_bytes?: number;
|
|
76
84
|
mount_config?: BoxCreateParams.MountConfig;
|
|
77
85
|
name?: string;
|
|
@@ -94,7 +102,16 @@ export interface BoxCreateParams {
|
|
|
94
102
|
* Applies to this request only.
|
|
95
103
|
*/
|
|
96
104
|
restore_memory?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Snapshot is a Docker-style name or name:tag reference to boot from. A bare name
|
|
107
|
+
* resolves to name:latest.
|
|
108
|
+
*/
|
|
109
|
+
snapshot?: string;
|
|
97
110
|
snapshot_id?: string;
|
|
111
|
+
/**
|
|
112
|
+
* SnapshotName is a synonym for Snapshot, accepted for compatibility with clients
|
|
113
|
+
* that predate it. Set one or the other.
|
|
114
|
+
*/
|
|
98
115
|
snapshot_name?: string;
|
|
99
116
|
tag_value_ids?: Array<string>;
|
|
100
117
|
vcpus?: number;
|
|
@@ -439,6 +456,10 @@ export interface BoxUpdateParams {
|
|
|
439
456
|
delete_after_stop_seconds?: number;
|
|
440
457
|
fs_capacity_bytes?: number;
|
|
441
458
|
idle_ttl_seconds?: number;
|
|
459
|
+
/**
|
|
460
|
+
* New memory for the sandbox, in bytes. The 4 GiB per vCPU ratio applies when the
|
|
461
|
+
* sandbox is created; a resize enforces only the maximum of 64 GiB.
|
|
462
|
+
*/
|
|
442
463
|
mem_bytes?: number;
|
|
443
464
|
name?: string;
|
|
444
465
|
proxy_config?: BoxUpdateParams.ProxyConfig;
|
|
@@ -596,6 +617,10 @@ export interface BoxCreateSnapshotParams {
|
|
|
596
617
|
labels?: {
|
|
597
618
|
[key: string]: string;
|
|
598
619
|
};
|
|
620
|
+
/**
|
|
621
|
+
* mutable Docker-style tag; defaults to "latest"
|
|
622
|
+
*/
|
|
623
|
+
tag?: string;
|
|
599
624
|
}
|
|
600
625
|
export interface BoxGenerateServiceURLParams {
|
|
601
626
|
expires_in_seconds?: number;
|
|
@@ -7,6 +7,8 @@ export class Boxes extends APIResource {
|
|
|
7
7
|
/**
|
|
8
8
|
* Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
|
|
9
9
|
* `snapshot_name`; if neither is provided, the server uses the default snapshot.
|
|
10
|
+
* `snapshot_name` accepts a Docker-style `name` or `name:tag` reference (a bare
|
|
11
|
+
* name resolves to `name:latest`).
|
|
10
12
|
*/
|
|
11
13
|
create(body, options) {
|
|
12
14
|
return this._client.post('/api/v2/sandboxes/boxes', { body, ...options });
|
|
@@ -4,7 +4,7 @@ import { BoxCreateParams, BoxCreateSnapshotParams, BoxGenerateServiceURLParams,
|
|
|
4
4
|
import * as RegistriesAPI from './registries.js';
|
|
5
5
|
import { Registries, RegistryCreateParams, RegistryListParams, RegistryListResponse, RegistryResponse, RegistryUpdateParams } from './registries.js';
|
|
6
6
|
import * as SnapshotsAPI from './snapshots.js';
|
|
7
|
-
import { SnapshotCreateParams, SnapshotListParams, Snapshots } from './snapshots.js';
|
|
7
|
+
import { SnapshotCreateParams, SnapshotListParams, SnapshotRetrieveByNameResponse, Snapshots } from './snapshots.js';
|
|
8
8
|
export declare class Sandboxes extends APIResource {
|
|
9
9
|
boxes: BoxesAPI.Boxes;
|
|
10
10
|
registries: RegistriesAPI.Registries;
|
|
@@ -411,11 +411,16 @@ export interface SnapshotResponse {
|
|
|
411
411
|
source_sandbox_id?: string;
|
|
412
412
|
status?: string;
|
|
413
413
|
status_message?: string;
|
|
414
|
+
/**
|
|
415
|
+
* Tags currently resolving to this snapshot, under Name. A snapshot with no tags
|
|
416
|
+
* is dangling — addressable only by id.
|
|
417
|
+
*/
|
|
418
|
+
tags?: Array<string>;
|
|
414
419
|
updated_at?: string;
|
|
415
420
|
}
|
|
416
421
|
export declare namespace Sandboxes {
|
|
417
422
|
export { type SandboxListResponse as SandboxListResponse, type SandboxResponse as SandboxResponse, type SandboxStatusResponse as SandboxStatusResponse, type ServiceURLResponse as ServiceURLResponse, type SnapshotListResponse as SnapshotListResponse, type SnapshotResponse as SnapshotResponse, };
|
|
418
423
|
export { Boxes as Boxes, type BoxCreateParams as BoxCreateParams, type BoxUpdateParams as BoxUpdateParams, type BoxListParams as BoxListParams, type BoxCreateSnapshotParams as BoxCreateSnapshotParams, type BoxGenerateServiceURLParams as BoxGenerateServiceURLParams, };
|
|
419
424
|
export { Registries as Registries, type RegistryListResponse as RegistryListResponse, type RegistryResponse as RegistryResponse, type RegistryCreateParams as RegistryCreateParams, type RegistryUpdateParams as RegistryUpdateParams, type RegistryListParams as RegistryListParams, };
|
|
420
|
-
export { Snapshots as Snapshots, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
|
|
425
|
+
export { Snapshots as Snapshots, type SnapshotRetrieveByNameResponse as SnapshotRetrieveByNameResponse, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
|
|
421
426
|
}
|
|
@@ -6,7 +6,7 @@ import { Boxes, } from './boxes.js';
|
|
|
6
6
|
import * as RegistriesAPI from './registries.js';
|
|
7
7
|
import { Registries, } from './registries.js';
|
|
8
8
|
import * as SnapshotsAPI from './snapshots.js';
|
|
9
|
-
import { Snapshots } from './snapshots.js';
|
|
9
|
+
import { Snapshots, } from './snapshots.js';
|
|
10
10
|
export class Sandboxes extends APIResource {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
@@ -14,7 +14,9 @@ class Snapshots extends resource_js_1.APIResource {
|
|
|
14
14
|
return this._client.post('/api/v2/sandboxes/snapshots', { body, ...options });
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
* Get a sandbox snapshot by ID.
|
|
17
|
+
* Get a sandbox snapshot by ID or by a Docker-style reference. A bare name means
|
|
18
|
+
* name:latest, falling back to the newest ready untagged snapshot of that name. To
|
|
19
|
+
* list the tags under a name, use /api/v2/sandboxes/snapshots-by-name/{name}.
|
|
18
20
|
*/
|
|
19
21
|
retrieve(snapshotID, options) {
|
|
20
22
|
return this._client.get((0, path_js_1.path) `/api/v2/sandboxes/snapshots/${snapshotID}`, options);
|
|
@@ -27,7 +29,8 @@ class Snapshots extends resource_js_1.APIResource {
|
|
|
27
29
|
return this._client.get('/api/v2/sandboxes/snapshots', { query, ...options });
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
|
-
* Delete a snapshot by ID
|
|
32
|
+
* Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
|
|
33
|
+
* underlying storage is reclaimed asynchronously.
|
|
31
34
|
*/
|
|
32
35
|
delete(snapshotID, options) {
|
|
33
36
|
return this._client.delete((0, path_js_1.path) `/api/v2/sandboxes/snapshots/${snapshotID}`, {
|
|
@@ -35,5 +38,12 @@ class Snapshots extends resource_js_1.APIResource {
|
|
|
35
38
|
headers: (0, headers_js_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
36
39
|
});
|
|
37
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Get a snapshot name and every tag under it, with the snapshot each tag resolves
|
|
43
|
+
* to. To fetch one snapshot, use /api/v2/sandboxes/snapshots/{snapshot_id}.
|
|
44
|
+
*/
|
|
45
|
+
retrieveByName(name, options) {
|
|
46
|
+
return this._client.get((0, path_js_1.path) `/api/v2/sandboxes/snapshots-by-name/${name}`, options);
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
exports.Snapshots = Snapshots;
|
|
@@ -8,7 +8,9 @@ export declare class Snapshots extends APIResource {
|
|
|
8
8
|
*/
|
|
9
9
|
create(body: SnapshotCreateParams, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotResponse>;
|
|
10
10
|
/**
|
|
11
|
-
* Get a sandbox snapshot by ID.
|
|
11
|
+
* Get a sandbox snapshot by ID or by a Docker-style reference. A bare name means
|
|
12
|
+
* name:latest, falling back to the newest ready untagged snapshot of that name. To
|
|
13
|
+
* list the tags under a name, use /api/v2/sandboxes/snapshots-by-name/{name}.
|
|
12
14
|
*/
|
|
13
15
|
retrieve(snapshotID: string, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotResponse>;
|
|
14
16
|
/**
|
|
@@ -17,9 +19,25 @@ export declare class Snapshots extends APIResource {
|
|
|
17
19
|
*/
|
|
18
20
|
list(query?: SnapshotListParams | null | undefined, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotListResponse>;
|
|
19
21
|
/**
|
|
20
|
-
* Delete a snapshot by ID
|
|
22
|
+
* Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
|
|
23
|
+
* underlying storage is reclaimed asynchronously.
|
|
21
24
|
*/
|
|
22
25
|
delete(snapshotID: string, options?: RequestOptions): APIPromise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Get a snapshot name and every tag under it, with the snapshot each tag resolves
|
|
28
|
+
* to. To fetch one snapshot, use /api/v2/sandboxes/snapshots/{snapshot_id}.
|
|
29
|
+
*/
|
|
30
|
+
retrieveByName(name: string, options?: RequestOptions): APIPromise<SnapshotRetrieveByNameResponse>;
|
|
31
|
+
}
|
|
32
|
+
export interface SnapshotRetrieveByNameResponse {
|
|
33
|
+
name?: string;
|
|
34
|
+
tags?: Array<SnapshotRetrieveByNameResponse.Tag>;
|
|
35
|
+
}
|
|
36
|
+
export declare namespace SnapshotRetrieveByNameResponse {
|
|
37
|
+
interface Tag {
|
|
38
|
+
snapshot_id?: string;
|
|
39
|
+
tag?: string;
|
|
40
|
+
}
|
|
23
41
|
}
|
|
24
42
|
export interface SnapshotCreateParams {
|
|
25
43
|
docker_image: string;
|
|
@@ -33,6 +51,10 @@ export interface SnapshotCreateParams {
|
|
|
33
51
|
[key: string]: string;
|
|
34
52
|
};
|
|
35
53
|
registry_id?: string;
|
|
54
|
+
/**
|
|
55
|
+
* mutable Docker-style tag; defaults to "latest"
|
|
56
|
+
*/
|
|
57
|
+
tag?: string;
|
|
36
58
|
}
|
|
37
59
|
export interface SnapshotListParams {
|
|
38
60
|
/**
|
|
@@ -70,5 +92,5 @@ export interface SnapshotListParams {
|
|
|
70
92
|
status?: string;
|
|
71
93
|
}
|
|
72
94
|
export declare namespace Snapshots {
|
|
73
|
-
export { type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams };
|
|
95
|
+
export { type SnapshotRetrieveByNameResponse as SnapshotRetrieveByNameResponse, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
|
|
74
96
|
}
|
|
@@ -11,7 +11,9 @@ export class Snapshots extends APIResource {
|
|
|
11
11
|
return this._client.post('/api/v2/sandboxes/snapshots', { body, ...options });
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Get a sandbox snapshot by ID.
|
|
14
|
+
* Get a sandbox snapshot by ID or by a Docker-style reference. A bare name means
|
|
15
|
+
* name:latest, falling back to the newest ready untagged snapshot of that name. To
|
|
16
|
+
* list the tags under a name, use /api/v2/sandboxes/snapshots-by-name/{name}.
|
|
15
17
|
*/
|
|
16
18
|
retrieve(snapshotID, options) {
|
|
17
19
|
return this._client.get(path `/api/v2/sandboxes/snapshots/${snapshotID}`, options);
|
|
@@ -24,7 +26,8 @@ export class Snapshots extends APIResource {
|
|
|
24
26
|
return this._client.get('/api/v2/sandboxes/snapshots', { query, ...options });
|
|
25
27
|
}
|
|
26
28
|
/**
|
|
27
|
-
* Delete a snapshot by ID
|
|
29
|
+
* Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
|
|
30
|
+
* underlying storage is reclaimed asynchronously.
|
|
28
31
|
*/
|
|
29
32
|
delete(snapshotID, options) {
|
|
30
33
|
return this._client.delete(path `/api/v2/sandboxes/snapshots/${snapshotID}`, {
|
|
@@ -32,4 +35,11 @@ export class Snapshots extends APIResource {
|
|
|
32
35
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
33
36
|
});
|
|
34
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Get a snapshot name and every tag under it, with the snapshot each tag resolves
|
|
40
|
+
* to. To fetch one snapshot, use /api/v2/sandboxes/snapshots/{snapshot_id}.
|
|
41
|
+
*/
|
|
42
|
+
retrieveByName(name, options) {
|
|
43
|
+
return this._client.get(path `/api/v2/sandboxes/snapshots-by-name/${name}`, options);
|
|
44
|
+
}
|
|
35
45
|
}
|
|
@@ -28,7 +28,7 @@ class Threads extends resource_js_1.APIResource {
|
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Query threads within a project (session), with cursor-based pagination. Returns
|
|
31
|
-
* threads matching the given time range and optional
|
|
31
|
+
* threads matching the given time range and optional filters.
|
|
32
32
|
*
|
|
33
33
|
* Self-hosted deployments require LangSmith `v0.16` or later.
|
|
34
34
|
*
|
|
@@ -22,7 +22,7 @@ export declare class Threads extends APIResource {
|
|
|
22
22
|
listTraces(threadID: string, query: ThreadListTracesParams, options?: RequestOptions): PagePromise<ThreadTracesItemsCursorGetPagination, ThreadTrace>;
|
|
23
23
|
/**
|
|
24
24
|
* Query threads within a project (session), with cursor-based pagination. Returns
|
|
25
|
-
* threads matching the given time range and optional
|
|
25
|
+
* threads matching the given time range and optional filters.
|
|
26
26
|
*
|
|
27
27
|
* Self-hosted deployments require LangSmith `v0.16` or later.
|
|
28
28
|
*
|
|
@@ -658,6 +658,31 @@ export interface ThreadQueryParams extends ItemsCursorPostPaginationParams {
|
|
|
658
658
|
* `project_id` is the tracing project UUID.
|
|
659
659
|
*/
|
|
660
660
|
project_id?: string;
|
|
661
|
+
/**
|
|
662
|
+
* `thread_filter` narrows results using a LangSmith filter expression evaluated
|
|
663
|
+
* against each complete thread summary. Self-hosted deployments require LangSmith
|
|
664
|
+
* v0.17 or later; unsupported deployments return 501. See
|
|
665
|
+
* https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
|
|
666
|
+
* for syntax.
|
|
667
|
+
*/
|
|
668
|
+
thread_filter?: string;
|
|
669
|
+
/**
|
|
670
|
+
* `trace_filter` narrows results to threads containing at least one trace whose
|
|
671
|
+
* root run matches this LangSmith filter expression. Trace-level aggregate fields
|
|
672
|
+
* are evaluated using the complete trace summary. Self-hosted deployments require
|
|
673
|
+
* LangSmith v0.17 or later; unsupported deployments return 501. See
|
|
674
|
+
* https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
|
|
675
|
+
* for syntax.
|
|
676
|
+
*/
|
|
677
|
+
trace_filter?: string;
|
|
678
|
+
/**
|
|
679
|
+
* `tree_filter` narrows results to threads containing at least one trace with a
|
|
680
|
+
* matching run anywhere in its run tree. Self-hosted deployments require LangSmith
|
|
681
|
+
* v0.17 or later; unsupported deployments return 501. See
|
|
682
|
+
* https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
|
|
683
|
+
* for syntax.
|
|
684
|
+
*/
|
|
685
|
+
tree_filter?: string;
|
|
661
686
|
}
|
|
662
687
|
export interface ThreadStatsParams {
|
|
663
688
|
/**
|
|
@@ -25,7 +25,7 @@ export class Threads extends APIResource {
|
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Query threads within a project (session), with cursor-based pagination. Returns
|
|
28
|
-
* threads matching the given time range and optional
|
|
28
|
+
* threads matching the given time range and optional filters.
|
|
29
29
|
*
|
|
30
30
|
* Self-hosted deployments require LangSmith `v0.16` or later.
|
|
31
31
|
*
|
package/dist/index.cjs
CHANGED
|
@@ -35,6 +35,6 @@ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, g
|
|
|
35
35
|
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_js_1.RateLimitError; } });
|
|
36
36
|
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_js_1.InternalServerError; } });
|
|
37
37
|
// Update using pnpm bump-version
|
|
38
|
-
exports.__version__ = "0.
|
|
38
|
+
exports.__version__ = "0.9.0";
|
|
39
39
|
// Metadata key to hide a traced run from LangSmith's Messages View.
|
|
40
40
|
exports.LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
|
package/dist/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export { computeRunIdForSecondaryReplica, uuid7, uuid7FromTime, } from "./uuid.j
|
|
|
7
7
|
export { isTracingEnabled } from "./utils/guard.js";
|
|
8
8
|
export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
9
9
|
export { LangsmithError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from "./_openapi_client/core/error.js";
|
|
10
|
-
export declare const __version__ = "0.
|
|
10
|
+
export declare const __version__ = "0.9.0";
|
|
11
11
|
export declare const LS_MESSAGE_VIEW_EXCLUDE: "ls_message_view_exclude";
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,6 @@ export { isTracingEnabled } from "./utils/guard.js";
|
|
|
7
7
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
8
|
export { LangsmithError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from "./_openapi_client/core/error.js";
|
|
9
9
|
// Update using pnpm bump-version
|
|
10
|
-
export const __version__ = "0.
|
|
10
|
+
export const __version__ = "0.9.0";
|
|
11
11
|
// Metadata key to hide a traced run from LangSmith's Messages View.
|
|
12
12
|
export const LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
|
package/dist/run_trees.cjs
CHANGED
|
@@ -140,6 +140,10 @@ class Baggage {
|
|
|
140
140
|
return items.join(",");
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
|
+
function getExcludeInputsOnPatch() {
|
|
144
|
+
const value = (0, env_js_3.getLangSmithEnvironmentVariable)("EXCLUDE_INPUTS_ON_PATCH");
|
|
145
|
+
return value === undefined || value.toLowerCase() === "true" || value === "1";
|
|
146
|
+
}
|
|
143
147
|
class RunTree {
|
|
144
148
|
constructor(originalConfig) {
|
|
145
149
|
Object.defineProperty(this, "id", {
|
|
@@ -737,7 +741,20 @@ class RunTree {
|
|
|
737
741
|
console.error(`Error in postRun for run ${this.id}:`, error);
|
|
738
742
|
}
|
|
739
743
|
}
|
|
744
|
+
/**
|
|
745
|
+
* Patch the run tree to the API.
|
|
746
|
+
*
|
|
747
|
+
* @param options.excludeInputs - Whether to exclude inputs from the patch
|
|
748
|
+
* request. Defaults to the value of `LANGSMITH_EXCLUDE_INPUTS_ON_PATCH`
|
|
749
|
+
* (or its `LANGCHAIN_` equivalent), which itself defaults to `true`.
|
|
750
|
+
* An explicit value overrides the environment variable for this call.
|
|
751
|
+
*
|
|
752
|
+
* Unless the environment variable is disabled, inputs added after the
|
|
753
|
+
* initial `postRun()` are not persisted unless this option is explicitly set
|
|
754
|
+
* to `false`.
|
|
755
|
+
*/
|
|
740
756
|
async patchRun(options) {
|
|
757
|
+
const excludeInputs = options?.excludeInputs ?? getExcludeInputsOnPatch();
|
|
741
758
|
if (this.replicas && this.replicas.length > 0) {
|
|
742
759
|
for (const { projectName, primary, apiKey, apiUrl, workspaceId, updates, reroot, client: replicaClient, } of this.replicas) {
|
|
743
760
|
const runData = this._remapForProject({
|
|
@@ -773,7 +790,7 @@ class RunTree {
|
|
|
773
790
|
// Important that inputs is not a key in the run update
|
|
774
791
|
// if excluded because it will overwrite the run create if the
|
|
775
792
|
// two operations are merged during batching
|
|
776
|
-
if (!
|
|
793
|
+
if (!excludeInputs) {
|
|
777
794
|
updatePayload.inputs = runData.inputs;
|
|
778
795
|
}
|
|
779
796
|
const targetClient = replicaClient ?? this.client;
|
|
@@ -806,7 +823,7 @@ class RunTree {
|
|
|
806
823
|
// Important that inputs is not a key in the run update
|
|
807
824
|
// if excluded because it will overwrite the run create if the
|
|
808
825
|
// two operations are merged during batching
|
|
809
|
-
if (!
|
|
826
|
+
if (!excludeInputs) {
|
|
810
827
|
runUpdate.inputs = this.inputs;
|
|
811
828
|
}
|
|
812
829
|
await this.client.updateRun(this.id, runUpdate);
|
package/dist/run_trees.d.ts
CHANGED
|
@@ -125,6 +125,18 @@ export declare class RunTree implements BaseRun {
|
|
|
125
125
|
private _setReplicaTraceRoot;
|
|
126
126
|
private _remapForProject;
|
|
127
127
|
postRun(excludeChildRuns?: boolean): Promise<void>;
|
|
128
|
+
/**
|
|
129
|
+
* Patch the run tree to the API.
|
|
130
|
+
*
|
|
131
|
+
* @param options.excludeInputs - Whether to exclude inputs from the patch
|
|
132
|
+
* request. Defaults to the value of `LANGSMITH_EXCLUDE_INPUTS_ON_PATCH`
|
|
133
|
+
* (or its `LANGCHAIN_` equivalent), which itself defaults to `true`.
|
|
134
|
+
* An explicit value overrides the environment variable for this call.
|
|
135
|
+
*
|
|
136
|
+
* Unless the environment variable is disabled, inputs added after the
|
|
137
|
+
* initial `postRun()` are not persisted unless this option is explicitly set
|
|
138
|
+
* to `false`.
|
|
139
|
+
*/
|
|
128
140
|
patchRun(options?: {
|
|
129
141
|
excludeInputs?: boolean;
|
|
130
142
|
}): Promise<void>;
|
package/dist/run_trees.js
CHANGED
|
@@ -134,6 +134,10 @@ class Baggage {
|
|
|
134
134
|
return items.join(",");
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
+
function getExcludeInputsOnPatch() {
|
|
138
|
+
const value = getLangSmithEnvironmentVariable("EXCLUDE_INPUTS_ON_PATCH");
|
|
139
|
+
return value === undefined || value.toLowerCase() === "true" || value === "1";
|
|
140
|
+
}
|
|
137
141
|
export class RunTree {
|
|
138
142
|
constructor(originalConfig) {
|
|
139
143
|
Object.defineProperty(this, "id", {
|
|
@@ -731,7 +735,20 @@ export class RunTree {
|
|
|
731
735
|
console.error(`Error in postRun for run ${this.id}:`, error);
|
|
732
736
|
}
|
|
733
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Patch the run tree to the API.
|
|
740
|
+
*
|
|
741
|
+
* @param options.excludeInputs - Whether to exclude inputs from the patch
|
|
742
|
+
* request. Defaults to the value of `LANGSMITH_EXCLUDE_INPUTS_ON_PATCH`
|
|
743
|
+
* (or its `LANGCHAIN_` equivalent), which itself defaults to `true`.
|
|
744
|
+
* An explicit value overrides the environment variable for this call.
|
|
745
|
+
*
|
|
746
|
+
* Unless the environment variable is disabled, inputs added after the
|
|
747
|
+
* initial `postRun()` are not persisted unless this option is explicitly set
|
|
748
|
+
* to `false`.
|
|
749
|
+
*/
|
|
734
750
|
async patchRun(options) {
|
|
751
|
+
const excludeInputs = options?.excludeInputs ?? getExcludeInputsOnPatch();
|
|
735
752
|
if (this.replicas && this.replicas.length > 0) {
|
|
736
753
|
for (const { projectName, primary, apiKey, apiUrl, workspaceId, updates, reroot, client: replicaClient, } of this.replicas) {
|
|
737
754
|
const runData = this._remapForProject({
|
|
@@ -767,7 +784,7 @@ export class RunTree {
|
|
|
767
784
|
// Important that inputs is not a key in the run update
|
|
768
785
|
// if excluded because it will overwrite the run create if the
|
|
769
786
|
// two operations are merged during batching
|
|
770
|
-
if (!
|
|
787
|
+
if (!excludeInputs) {
|
|
771
788
|
updatePayload.inputs = runData.inputs;
|
|
772
789
|
}
|
|
773
790
|
const targetClient = replicaClient ?? this.client;
|
|
@@ -800,7 +817,7 @@ export class RunTree {
|
|
|
800
817
|
// Important that inputs is not a key in the run update
|
|
801
818
|
// if excluded because it will overwrite the run create if the
|
|
802
819
|
// two operations are merged during batching
|
|
803
|
-
if (!
|
|
820
|
+
if (!excludeInputs) {
|
|
804
821
|
runUpdate.inputs = this.inputs;
|
|
805
822
|
}
|
|
806
823
|
await this.client.updateRun(this.id, runUpdate);
|
package/dist/sandbox/client.cjs
CHANGED
|
@@ -403,6 +403,10 @@ class SandboxClient {
|
|
|
403
403
|
* Callers can add specific status checks (e.g. 404) before calling this.
|
|
404
404
|
* @internal
|
|
405
405
|
*/
|
|
406
|
+
_boxUrl(name, ...segments) {
|
|
407
|
+
const suffix = segments.length ? `/${segments.join("/")}` : "";
|
|
408
|
+
return `${this._baseUrl}/boxes/${encodeURIComponent(name)}${suffix}`;
|
|
409
|
+
}
|
|
406
410
|
async _postJson(url, body, options) {
|
|
407
411
|
const response = await this._fetch(url, {
|
|
408
412
|
method: "POST",
|
|
@@ -487,7 +491,7 @@ class SandboxClient {
|
|
|
487
491
|
* @throws LangSmithResourceNotFoundError if sandbox not found.
|
|
488
492
|
*/
|
|
489
493
|
async getSandbox(name, options) {
|
|
490
|
-
const url =
|
|
494
|
+
const url = this._boxUrl(name);
|
|
491
495
|
const response = await this._fetch(url, { signal: options?.signal });
|
|
492
496
|
if (!response.ok) {
|
|
493
497
|
if (response.status === 404) {
|
|
@@ -527,7 +531,7 @@ class SandboxClient {
|
|
|
527
531
|
deleteAfterStopSeconds === undefined) {
|
|
528
532
|
return this.getSandbox(name);
|
|
529
533
|
}
|
|
530
|
-
const url =
|
|
534
|
+
const url = this._boxUrl(name);
|
|
531
535
|
const payload = {};
|
|
532
536
|
if (newName !== undefined) {
|
|
533
537
|
payload.name = newName;
|
|
@@ -564,7 +568,7 @@ class SandboxClient {
|
|
|
564
568
|
* @throws LangSmithResourceNotFoundError if sandbox not found.
|
|
565
569
|
*/
|
|
566
570
|
async deleteSandbox(name) {
|
|
567
|
-
const url =
|
|
571
|
+
const url = this._boxUrl(name);
|
|
568
572
|
const response = await this._fetch(url, { method: "DELETE" });
|
|
569
573
|
if (!response.ok) {
|
|
570
574
|
if (response.status === 404) {
|
|
@@ -584,7 +588,7 @@ class SandboxClient {
|
|
|
584
588
|
* @throws LangSmithResourceNotFoundError if sandbox not found.
|
|
585
589
|
*/
|
|
586
590
|
async getSandboxStatus(name, options) {
|
|
587
|
-
const url =
|
|
591
|
+
const url = this._boxUrl(name, "status");
|
|
588
592
|
const response = await this._fetch(url, { signal: options?.signal });
|
|
589
593
|
if (!response.ok) {
|
|
590
594
|
if (response.status === 404) {
|
|
@@ -647,17 +651,61 @@ class SandboxClient {
|
|
|
647
651
|
*/
|
|
648
652
|
async startSandbox(name, options = {}) {
|
|
649
653
|
const { timeout = 120, signal } = options;
|
|
650
|
-
const url =
|
|
654
|
+
const url = this._boxUrl(name, "start");
|
|
651
655
|
await this._postJson(url, {}, { signal });
|
|
652
656
|
return this.waitForSandbox(name, { timeout, signal });
|
|
653
657
|
}
|
|
658
|
+
/**
|
|
659
|
+
* Create a link that downloads one file from a sandbox.
|
|
660
|
+
*
|
|
661
|
+
* The link carries its own token, so anyone holding the URL can fetch that
|
|
662
|
+
* one file without a LangSmith credential. It is pinned to the sandbox and
|
|
663
|
+
* the exact path and cannot be repointed at another file. Fetching wakes a
|
|
664
|
+
* stopped sandbox.
|
|
665
|
+
*
|
|
666
|
+
* Do not modify the file after minting a link for it. The link is pinned to
|
|
667
|
+
* a path, not to a snapshot of the contents, so a later write to that path
|
|
668
|
+
* may or may not be reflected in what the link serves. Write a new file and
|
|
669
|
+
* mint a new link when the contents change.
|
|
670
|
+
*
|
|
671
|
+
* @param name - Sandbox name.
|
|
672
|
+
* @param path - File path inside the sandbox.
|
|
673
|
+
* @param options - Expiry and response header overrides.
|
|
674
|
+
* @returns The link and its expiry, if any.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```typescript
|
|
678
|
+
* const link = await client.generateDownloadURL("my-vm", "/tmp/report.pdf");
|
|
679
|
+
* console.log(link.download_url);
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
682
|
+
async generateDownloadURL(name, path, options = {}) {
|
|
683
|
+
const { expiresInSeconds, contentType, contentDisposition, signal } = options;
|
|
684
|
+
if (expiresInSeconds !== undefined && expiresInSeconds < 1) {
|
|
685
|
+
throw new errors_js_1.LangSmithValidationError(`expiresInSeconds must be greater than 0 (got ${expiresInSeconds}); ` +
|
|
686
|
+
`omit it for a link that never expires`);
|
|
687
|
+
}
|
|
688
|
+
const url = this._boxUrl(name, "download-url");
|
|
689
|
+
const payload = { path };
|
|
690
|
+
if (expiresInSeconds !== undefined) {
|
|
691
|
+
payload.expires_in_seconds = expiresInSeconds;
|
|
692
|
+
}
|
|
693
|
+
if (contentType !== undefined) {
|
|
694
|
+
payload.content_type = contentType;
|
|
695
|
+
}
|
|
696
|
+
if (contentDisposition !== undefined) {
|
|
697
|
+
payload.content_disposition = contentDisposition;
|
|
698
|
+
}
|
|
699
|
+
const response = await this._postJson(url, payload, { signal });
|
|
700
|
+
return (await response.json());
|
|
701
|
+
}
|
|
654
702
|
/**
|
|
655
703
|
* Stop a running sandbox (preserves sandbox files for later restart).
|
|
656
704
|
*
|
|
657
705
|
* @param name - Sandbox name.
|
|
658
706
|
*/
|
|
659
707
|
async stopSandbox(name) {
|
|
660
|
-
const url =
|
|
708
|
+
const url = this._boxUrl(name, "stop");
|
|
661
709
|
await this._postJson(url, {});
|
|
662
710
|
}
|
|
663
711
|
// =========================================================================
|
|
@@ -778,7 +826,7 @@ class SandboxClient {
|
|
|
778
826
|
*/
|
|
779
827
|
async captureSnapshot(sandboxName, name, options = {}) {
|
|
780
828
|
const { dockerImage, fsCapacityBytes, timeout = 60, signal } = options;
|
|
781
|
-
const url =
|
|
829
|
+
const url = this._boxUrl(sandboxName, "snapshot");
|
|
782
830
|
const payload = { name };
|
|
783
831
|
if (dockerImage !== undefined) {
|
|
784
832
|
payload.docker_image = dockerImage;
|