langsmith 0.10.7 → 0.10.9
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/client.cjs +26 -2
- package/dist/_openapi_client/client.d.ts +15 -6
- package/dist/_openapi_client/client.js +27 -3
- package/dist/_openapi_client/internal/detect-platform.cjs +1 -1
- package/dist/_openapi_client/internal/detect-platform.js +1 -1
- package/dist/_openapi_client/resources/annotation-queues/items.cjs +13 -6
- package/dist/_openapi_client/resources/annotation-queues/items.d.ts +33 -8
- package/dist/_openapi_client/resources/annotation-queues/items.js +13 -6
- package/dist/_openapi_client/resources/datasets/datasets.cjs +9 -0
- package/dist/_openapi_client/resources/datasets/datasets.d.ts +4 -0
- package/dist/_openapi_client/resources/datasets/datasets.js +9 -0
- package/dist/_openapi_client/resources/datasets/examples.cjs +26 -0
- package/dist/_openapi_client/resources/datasets/examples.d.ts +23 -0
- package/dist/_openapi_client/resources/datasets/examples.js +22 -0
- package/dist/_openapi_client/resources/fleet/fleet.cjs +54 -0
- package/dist/_openapi_client/resources/fleet/fleet.d.ts +9 -0
- package/dist/_openapi_client/resources/fleet/fleet.js +17 -0
- package/dist/_openapi_client/resources/fleet/threads.cjs +18 -0
- package/dist/_openapi_client/resources/fleet/threads.d.ts +19 -0
- package/dist/_openapi_client/resources/fleet/threads.js +14 -0
- package/dist/_openapi_client/resources/index.cjs +8 -2
- package/dist/_openapi_client/resources/index.d.ts +6 -3
- package/dist/_openapi_client/resources/index.js +5 -2
- package/dist/_openapi_client/resources/info.d.ts +6 -0
- package/dist/_openapi_client/resources/issues.cjs +2 -2
- package/dist/_openapi_client/resources/issues.d.ts +188 -4
- package/dist/_openapi_client/resources/issues.js +2 -2
- package/dist/_openapi_client/resources/online-evaluators.cjs +7 -4
- package/dist/_openapi_client/resources/online-evaluators.d.ts +63 -4
- package/dist/_openapi_client/resources/online-evaluators.js +7 -4
- package/dist/_openapi_client/resources/product-feedback.cjs +33 -0
- package/dist/_openapi_client/resources/product-feedback.d.ts +77 -0
- package/dist/_openapi_client/resources/product-feedback.js +29 -0
- package/dist/_openapi_client/resources/runs/runs.d.ts +26 -16
- package/dist/_openapi_client/resources/sandboxes/boxes.cjs +44 -4
- package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +256 -21
- package/dist/_openapi_client/resources/sandboxes/boxes.js +44 -4
- package/dist/_openapi_client/resources/sandboxes/registries.d.ts +10 -2
- package/dist/_openapi_client/resources/sandboxes/sandboxes.cjs +13 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +169 -14
- package/dist/_openapi_client/resources/sandboxes/sandboxes.js +13 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +10 -6
- package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +37 -6
- package/dist/_openapi_client/resources/sandboxes/snapshots.js +10 -6
- package/dist/_openapi_client/resources/sessions.cjs +23 -0
- package/dist/_openapi_client/resources/sessions.d.ts +732 -0
- package/dist/_openapi_client/resources/sessions.js +19 -0
- package/dist/_openapi_client/resources/threads/index.cjs +9 -0
- package/dist/_openapi_client/resources/threads/index.d.ts +2 -0
- package/dist/_openapi_client/resources/threads/index.js +4 -0
- package/dist/_openapi_client/resources/threads/share.cjs +61 -0
- package/dist/_openapi_client/resources/threads/share.d.ts +71 -0
- package/dist/_openapi_client/resources/threads/share.js +57 -0
- package/dist/_openapi_client/resources/threads/threads.cjs +143 -0
- package/dist/_openapi_client/resources/threads/threads.d.ts +973 -0
- package/dist/_openapi_client/resources/threads/threads.js +106 -0
- package/dist/_openapi_client/resources/threads.cjs +15 -67
- package/dist/_openapi_client/resources/threads.d.ts +1 -709
- package/dist/_openapi_client/resources/threads.js +1 -65
- package/dist/_openapi_client/resources/traces.d.ts +7 -1
- package/dist/_openapi_client/version.cjs +1 -1
- package/dist/_openapi_client/version.js +1 -1
- package/dist/address.cjs +176 -99
- package/dist/address.d.ts +63 -8
- package/dist/address.js +170 -90
- package/dist/anonymizer/index.cjs +1 -1
- package/dist/anonymizer/index.js +1 -1
- package/dist/client.cjs +39 -19
- package/dist/client.d.ts +20 -4
- package/dist/client.js +34 -14
- package/dist/experimental/otel/exporter.cjs +21 -4
- package/dist/experimental/otel/exporter.d.ts +4 -2
- package/dist/experimental/otel/exporter.js +21 -4
- package/dist/index.cjs +5 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/run_trees.cjs +26 -43
- package/dist/run_trees.d.ts +4 -4
- package/dist/run_trees.js +23 -40
- package/dist/sandbox/client.cjs +33 -4
- package/dist/sandbox/client.d.ts +4 -0
- package/dist/sandbox/client.js +34 -5
- package/dist/sandbox/command_handle.cjs +8 -0
- package/dist/sandbox/command_handle.js +8 -0
- package/dist/sandbox/sandbox.cjs +7 -0
- package/dist/sandbox/sandbox.js +7 -0
- package/dist/sandbox/service_url.cjs +9 -1
- package/dist/sandbox/service_url.d.ts +2 -1
- package/dist/sandbox/service_url.js +9 -1
- package/dist/sandbox/tracing.cjs +13 -0
- package/dist/sandbox/tracing.d.ts +1 -0
- package/dist/sandbox/tracing.js +10 -0
- package/dist/schemas.d.ts +3 -3
- package/dist/traceable.cjs +5 -4
- package/dist/traceable.js +4 -3
- package/dist/utils/{agent_addressing.cjs → addressing.cjs} +22 -23
- package/dist/utils/{agent_addressing.d.ts → addressing.d.ts} +5 -8
- package/dist/utils/{agent_addressing.js → addressing.js} +23 -23
- package/dist/utils/env.cjs +6 -4
- package/dist/utils/env.js +6 -4
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
import { APIResource } from '../core/resource.js';
|
|
4
|
+
export class Sessions extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* **Beta:** This endpoint is in active development and may change without notice.
|
|
7
|
+
* Returns the tracing project (session) an address names. An address is an AGENT
|
|
8
|
+
* (`id` and `environment`), an EXPERIMENT (`id`), or an EVALUATOR (no `id`:
|
|
9
|
+
* evaluator traces share one project per workspace). Send `kind` and `environment`
|
|
10
|
+
* in upper case, as listed; they are matched case-insensitively, while the Agent
|
|
11
|
+
* `id` is case-sensitive. An address that does not exist, or whose project you
|
|
12
|
+
* cannot read, is a 404. Pass the returned `session_id` to any endpoint that takes
|
|
13
|
+
* a project (session) ID. This is not supported on a BYOC data plane yet, and is a
|
|
14
|
+
* 501 there.
|
|
15
|
+
*/
|
|
16
|
+
resolve(query, options) {
|
|
17
|
+
return this._client.get('/api/v1/sessions/resolutions', { query, ...options });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Threads = exports.Share = void 0;
|
|
6
|
+
var share_js_1 = require("./share.cjs");
|
|
7
|
+
Object.defineProperty(exports, "Share", { enumerable: true, get: function () { return share_js_1.Share; } });
|
|
8
|
+
var threads_js_1 = require("./threads.cjs");
|
|
9
|
+
Object.defineProperty(exports, "Threads", { enumerable: true, get: function () { return threads_js_1.Threads; } });
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Share, type ShareCreateResponse, type ShareRetrieveResponse, type ShareCreateParams, type ShareRetrieveParams, type ShareDeleteParams, } from './share.js';
|
|
2
|
+
export { Threads, type Thread, type ThreadStats, type ThreadTrace, type ThreadAggregateStatsResponse, type ThreadAggregateStatsParams, type ThreadListTracesParams, type ThreadQueryParams, type ThreadStatsParams, type ThreadTracesItemsCursorGetPagination, type ThreadsItemsCursorPostPagination, } from './threads.js';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Share = void 0;
|
|
6
|
+
const resource_js_1 = require("../../core/resource.cjs");
|
|
7
|
+
const headers_js_1 = require("../../internal/headers.cjs");
|
|
8
|
+
const path_js_1 = require("../../internal/utils/path.cjs");
|
|
9
|
+
class Share extends resource_js_1.APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Mints a public share token for a thread. Idempotent: sharing an already-shared
|
|
12
|
+
* thread returns the existing token.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const share = await client.threads.share.create(
|
|
17
|
+
* 'thread_id',
|
|
18
|
+
* { project_id: '018e4c7e-a9fb-7ef0-a5b6-6ea3a82e9327' },
|
|
19
|
+
* );
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
create(threadID, body, options) {
|
|
23
|
+
return this._client.post((0, path_js_1.path) `/api/v2/threads/${threadID}/share`, { body, ...options });
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns the share token for a thread. The token is omitted when the thread is
|
|
27
|
+
* not shared. Gated on runs:share so the control's state matches the control's
|
|
28
|
+
* permission.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const share = await client.threads.share.retrieve(
|
|
33
|
+
* 'thread_id',
|
|
34
|
+
* { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
|
|
35
|
+
* );
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
retrieve(threadID, query, options) {
|
|
39
|
+
return this._client.get((0, path_js_1.path) `/api/v2/threads/${threadID}/share`, { query, ...options });
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Deletes the share token for a thread. Idempotent: returns 204 whether or not a
|
|
43
|
+
* share token existed. Deliberately does not verify the thread still exists.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* await client.threads.share.delete('thread_id', {
|
|
48
|
+
* project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
delete(threadID, params, options) {
|
|
53
|
+
const { project_id } = params;
|
|
54
|
+
return this._client.delete((0, path_js_1.path) `/api/v2/threads/${threadID}/share`, {
|
|
55
|
+
query: { project_id },
|
|
56
|
+
...options,
|
|
57
|
+
headers: (0, headers_js_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.Share = Share;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { APIResource } from '../../core/resource.js';
|
|
2
|
+
import { APIPromise } from '../../core/api-promise.js';
|
|
3
|
+
import { RequestOptions } from '../../internal/request-options.js';
|
|
4
|
+
export declare class Share extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Mints a public share token for a thread. Idempotent: sharing an already-shared
|
|
7
|
+
* thread returns the existing token.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const share = await client.threads.share.create(
|
|
12
|
+
* 'thread_id',
|
|
13
|
+
* { project_id: '018e4c7e-a9fb-7ef0-a5b6-6ea3a82e9327' },
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
create(threadID: string, body: ShareCreateParams, options?: RequestOptions): APIPromise<ShareCreateResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the share token for a thread. The token is omitted when the thread is
|
|
20
|
+
* not shared. Gated on runs:share so the control's state matches the control's
|
|
21
|
+
* permission.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const share = await client.threads.share.retrieve(
|
|
26
|
+
* 'thread_id',
|
|
27
|
+
* { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
|
|
28
|
+
* );
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
retrieve(threadID: string, query: ShareRetrieveParams, options?: RequestOptions): APIPromise<ShareRetrieveResponse>;
|
|
32
|
+
/**
|
|
33
|
+
* Deletes the share token for a thread. Idempotent: returns 204 whether or not a
|
|
34
|
+
* share token existed. Deliberately does not verify the thread still exists.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* await client.threads.share.delete('thread_id', {
|
|
39
|
+
* project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
delete(threadID: string, params: ShareDeleteParams, options?: RequestOptions): APIPromise<void>;
|
|
44
|
+
}
|
|
45
|
+
export interface ShareCreateResponse {
|
|
46
|
+
share_token?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ShareRetrieveResponse {
|
|
49
|
+
share_token?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ShareCreateParams {
|
|
52
|
+
/**
|
|
53
|
+
* project_id is the tracing project UUID containing the thread.
|
|
54
|
+
*/
|
|
55
|
+
project_id: string;
|
|
56
|
+
}
|
|
57
|
+
export interface ShareRetrieveParams {
|
|
58
|
+
/**
|
|
59
|
+
* Project UUID
|
|
60
|
+
*/
|
|
61
|
+
project_id: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ShareDeleteParams {
|
|
64
|
+
/**
|
|
65
|
+
* Project UUID
|
|
66
|
+
*/
|
|
67
|
+
project_id: string;
|
|
68
|
+
}
|
|
69
|
+
export declare namespace Share {
|
|
70
|
+
export { type ShareCreateResponse as ShareCreateResponse, type ShareRetrieveResponse as ShareRetrieveResponse, type ShareCreateParams as ShareCreateParams, type ShareRetrieveParams as ShareRetrieveParams, type ShareDeleteParams as ShareDeleteParams, };
|
|
71
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
import { APIResource } from '../../core/resource.js';
|
|
4
|
+
import { buildHeaders } from '../../internal/headers.js';
|
|
5
|
+
import { path } from '../../internal/utils/path.js';
|
|
6
|
+
export class Share extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Mints a public share token for a thread. Idempotent: sharing an already-shared
|
|
9
|
+
* thread returns the existing token.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const share = await client.threads.share.create(
|
|
14
|
+
* 'thread_id',
|
|
15
|
+
* { project_id: '018e4c7e-a9fb-7ef0-a5b6-6ea3a82e9327' },
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
create(threadID, body, options) {
|
|
20
|
+
return this._client.post(path `/api/v2/threads/${threadID}/share`, { body, ...options });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Returns the share token for a thread. The token is omitted when the thread is
|
|
24
|
+
* not shared. Gated on runs:share so the control's state matches the control's
|
|
25
|
+
* permission.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const share = await client.threads.share.retrieve(
|
|
30
|
+
* 'thread_id',
|
|
31
|
+
* { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
retrieve(threadID, query, options) {
|
|
36
|
+
return this._client.get(path `/api/v2/threads/${threadID}/share`, { query, ...options });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Deletes the share token for a thread. Idempotent: returns 204 whether or not a
|
|
40
|
+
* share token existed. Deliberately does not verify the thread still exists.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* await client.threads.share.delete('thread_id', {
|
|
45
|
+
* project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
46
|
+
* });
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
delete(threadID, params, options) {
|
|
50
|
+
const { project_id } = params;
|
|
51
|
+
return this._client.delete(path `/api/v2/threads/${threadID}/share`, {
|
|
52
|
+
query: { project_id },
|
|
53
|
+
...options,
|
|
54
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
|
+
if (k2 === undefined) k2 = k;
|
|
6
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
7
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
8
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
9
|
+
}
|
|
10
|
+
Object.defineProperty(o, k2, desc);
|
|
11
|
+
}) : (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
o[k2] = m[k];
|
|
14
|
+
}));
|
|
15
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
16
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
17
|
+
}) : function(o, v) {
|
|
18
|
+
o["default"] = v;
|
|
19
|
+
});
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.Threads = void 0;
|
|
39
|
+
const resource_js_1 = require("../../core/resource.cjs");
|
|
40
|
+
const ShareAPI = __importStar(require("./share.cjs"));
|
|
41
|
+
const share_js_1 = require("./share.cjs");
|
|
42
|
+
const pagination_js_1 = require("../../core/pagination.cjs");
|
|
43
|
+
const headers_js_1 = require("../../internal/headers.cjs");
|
|
44
|
+
const path_js_1 = require("../../internal/utils/path.cjs");
|
|
45
|
+
class Threads extends resource_js_1.APIResource {
|
|
46
|
+
constructor() {
|
|
47
|
+
super(...arguments);
|
|
48
|
+
Object.defineProperty(this, "share", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true,
|
|
52
|
+
value: new ShareAPI.Share(this._client)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* GET with body payload — no resources created. Returns aggregate statistics for
|
|
57
|
+
* threads in a tracing project. The response includes the thread counts, run
|
|
58
|
+
* counts, latency percentiles, rates, token totals, and cost totals requested in
|
|
59
|
+
* `select`.
|
|
60
|
+
*
|
|
61
|
+
* Self-hosted deployments require LangSmith `v0.17` or later.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const response = await client.threads.aggregateStats({
|
|
66
|
+
* project_id: '0190a1b2-c3d4-7ef0-a5b6-6ea3a82e9328',
|
|
67
|
+
* select: [
|
|
68
|
+
* 'THREAD_COUNT',
|
|
69
|
+
* 'TRACE_COUNT',
|
|
70
|
+
* 'TOTAL_TOKENS',
|
|
71
|
+
* 'TOTAL_COST',
|
|
72
|
+
* ],
|
|
73
|
+
* });
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
aggregateStats(body, options) {
|
|
77
|
+
return this._client.post('/api/v2/threads/stats', { body, ...options });
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Retrieve all traces belonging to a specific thread within a project.
|
|
81
|
+
*
|
|
82
|
+
* Self-hosted deployments require LangSmith `v0.16` or later.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* // Automatically fetches more pages as needed.
|
|
87
|
+
* for await (const threadTrace of client.threads.listTraces(
|
|
88
|
+
* 'thread_id',
|
|
89
|
+
* { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
|
|
90
|
+
* )) {
|
|
91
|
+
* // ...
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
listTraces(threadID, query, options) {
|
|
96
|
+
return this._client.getAPIList((0, path_js_1.path) `/api/v2/threads/${threadID}/traces`, (pagination_js_1.ItemsCursorGetPagination), { query, ...options });
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Query threads within a project (session), with cursor-based pagination. Returns
|
|
100
|
+
* threads matching the given time range and optional filters.
|
|
101
|
+
*
|
|
102
|
+
* Self-hosted deployments require LangSmith `v0.16` or later.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* // Automatically fetches more pages as needed.
|
|
107
|
+
* for await (const thread of client.threads.query()) {
|
|
108
|
+
* // ...
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
query(params, options) {
|
|
113
|
+
const { Accept, ...body } = params;
|
|
114
|
+
return this._client.getAPIList('/api/v2/threads/query', (pagination_js_1.ItemsCursorPostPagination), {
|
|
115
|
+
body,
|
|
116
|
+
method: 'post',
|
|
117
|
+
...options,
|
|
118
|
+
headers: (0, headers_js_1.buildHeaders)([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Compute aggregate stats for a single thread (turn count, latency percentiles,
|
|
123
|
+
* token/cost sums, and detail breakdowns) within a project.
|
|
124
|
+
*
|
|
125
|
+
* Self-hosted deployments require LangSmith `v0.16` or later.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts
|
|
129
|
+
* const threadStats = await client.threads.stats(
|
|
130
|
+
* 'thread_id',
|
|
131
|
+
* {
|
|
132
|
+
* selects: ['TURNS'],
|
|
133
|
+
* session_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
|
|
134
|
+
* },
|
|
135
|
+
* );
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
stats(threadID, query, options) {
|
|
139
|
+
return this._client.get((0, path_js_1.path) `/api/v2/threads/${threadID}/stats`, { query, ...options });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.Threads = Threads;
|
|
143
|
+
Threads.Share = share_js_1.Share;
|