langsmith 0.7.12 → 0.7.14
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 +9 -1
- package/dist/_openapi_client/client.d.ts +5 -2
- package/dist/_openapi_client/client.js +9 -1
- package/dist/_openapi_client/resources/datasets/datasets.cjs +5 -14
- package/dist/_openapi_client/resources/datasets/datasets.d.ts +6 -10
- package/dist/_openapi_client/resources/datasets/datasets.js +5 -14
- package/dist/_openapi_client/resources/datasets/experiment-runs.cjs +18 -0
- package/dist/_openapi_client/resources/datasets/experiment-runs.d.ts +109 -0
- package/dist/_openapi_client/resources/datasets/experiment-runs.js +14 -0
- package/dist/_openapi_client/resources/datasets/runs.cjs +0 -7
- package/dist/_openapi_client/resources/datasets/runs.d.ts +1 -45
- package/dist/_openapi_client/resources/datasets/runs.js +0 -7
- package/dist/_openapi_client/resources/index.cjs +4 -2
- package/dist/_openapi_client/resources/index.d.ts +2 -1
- package/dist/_openapi_client/resources/index.js +2 -1
- package/dist/_openapi_client/resources/runs/runs.d.ts +1 -1
- package/dist/_openapi_client/resources/sandboxes/boxes.cjs +86 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +465 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.js +82 -0
- package/dist/_openapi_client/resources/sandboxes/registries.cjs +44 -0
- package/dist/_openapi_client/resources/sandboxes/registries.d.ts +67 -0
- package/dist/_openapi_client/resources/sandboxes/registries.js +40 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.cjs +72 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +309 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.js +35 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +39 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +62 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.js +35 -0
- package/dist/_openapi_client/resources/sessions.cjs +53 -0
- package/dist/_openapi_client/resources/{sessions/sessions.d.ts → sessions.d.ts} +13 -51
- package/dist/_openapi_client/resources/sessions.js +49 -0
- package/dist/client.cjs +44 -0
- package/dist/client.d.ts +31 -0
- package/dist/client.js +44 -0
- package/dist/experimental/anthropic/context.cjs +5 -1
- package/dist/experimental/anthropic/context.js +5 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sandbox/client.cjs +58 -15
- package/dist/sandbox/client.d.ts +27 -1
- package/dist/sandbox/client.js +54 -11
- package/dist/sandbox/sandbox.cjs +7 -6
- package/dist/sandbox/sandbox.d.ts +7 -2
- package/dist/sandbox/sandbox.js +8 -7
- package/dist/sandbox/types.d.ts +1 -7
- package/package.json +1 -1
- package/dist/_openapi_client/resources/datasets/experiments.cjs +0 -16
- package/dist/_openapi_client/resources/datasets/experiments.d.ts +0 -23
- package/dist/_openapi_client/resources/datasets/experiments.js +0 -12
- package/dist/_openapi_client/resources/datasets/group.cjs +0 -17
- package/dist/_openapi_client/resources/datasets/group.d.ts +0 -160
- package/dist/_openapi_client/resources/datasets/group.js +0 -13
- package/dist/_openapi_client/resources/sessions/insights.cjs +0 -54
- package/dist/_openapi_client/resources/sessions/insights.d.ts +0 -246
- package/dist/_openapi_client/resources/sessions/insights.js +0 -50
- package/dist/_openapi_client/resources/sessions/sessions.cjs +0 -109
- package/dist/_openapi_client/resources/sessions/sessions.js +0 -72
package/dist/sandbox/client.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { getLangSmithEnvironmentVariable } from "../utils/env.js";
|
|
5
5
|
import { _getFetchImplementation } from "../singletons/fetch.js";
|
|
6
6
|
import { AsyncCaller } from "../utils/async_caller.js";
|
|
7
|
+
import { Langsmith as OpenAPILangsmith } from "../_openapi_client/index.js";
|
|
7
8
|
import { Sandbox } from "./sandbox.js";
|
|
8
9
|
import { LangSmithResourceCreationError, LangSmithResourceNameConflictError, LangSmithResourceNotFoundError, LangSmithResourceTimeoutError, LangSmithSandboxAPIError, LangSmithValidationError, } from "./errors.js";
|
|
9
10
|
import { handleClientHttpError, handleSandboxCreationError, validateTtl, } from "./helpers.js";
|
|
@@ -293,6 +294,12 @@ export class SandboxClient {
|
|
|
293
294
|
writable: true,
|
|
294
295
|
value: void 0
|
|
295
296
|
});
|
|
297
|
+
Object.defineProperty(this, "_registriesClient", {
|
|
298
|
+
enumerable: true,
|
|
299
|
+
configurable: true,
|
|
300
|
+
writable: true,
|
|
301
|
+
value: void 0
|
|
302
|
+
});
|
|
296
303
|
this._baseUrl = (config.apiEndpoint ?? getDefaultApiEndpoint()).replace(/\/$/, "");
|
|
297
304
|
this._apiKey = config.apiKey ?? getDefaultApiKey();
|
|
298
305
|
this._defaultHeaders = { ...(config.headers ?? {}) };
|
|
@@ -302,6 +309,51 @@ export class SandboxClient {
|
|
|
302
309
|
maxConcurrency: config.maxConcurrency ?? Infinity,
|
|
303
310
|
});
|
|
304
311
|
}
|
|
312
|
+
_apiRoot() {
|
|
313
|
+
const suffix = "/v2/sandboxes";
|
|
314
|
+
return this._baseUrl.endsWith(suffix)
|
|
315
|
+
? this._baseUrl.slice(0, -suffix.length)
|
|
316
|
+
: this._baseUrl;
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Manage sandbox image registries: create, list, retrieve, update, delete.
|
|
320
|
+
*
|
|
321
|
+
* A registry stores credentials for pulling private images. Create one, then
|
|
322
|
+
* pass its `id` as `registryId` when building a snapshot.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* const registry = await client.registries.create({
|
|
327
|
+
* name: "internal",
|
|
328
|
+
* url: "registry.example.com",
|
|
329
|
+
* username: "robot",
|
|
330
|
+
* password: process.env.REGISTRY_PASSWORD,
|
|
331
|
+
* });
|
|
332
|
+
* const snapshot = await client.createSnapshot(
|
|
333
|
+
* "internal-python",
|
|
334
|
+
* "registry.example.com/internal/python:3.12",
|
|
335
|
+
* 2_147_483_648,
|
|
336
|
+
* { registryId: registry.id },
|
|
337
|
+
* );
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
get registries() {
|
|
341
|
+
if (!this._registriesClient) {
|
|
342
|
+
const defaultHeaders = {
|
|
343
|
+
...this._defaultHeaders,
|
|
344
|
+
};
|
|
345
|
+
if (this._apiKey === undefined) {
|
|
346
|
+
defaultHeaders["X-API-Key"] = null;
|
|
347
|
+
}
|
|
348
|
+
this._registriesClient = new OpenAPILangsmith({
|
|
349
|
+
apiKey: this._apiKey,
|
|
350
|
+
baseURL: this._apiRoot(),
|
|
351
|
+
defaultHeaders,
|
|
352
|
+
fetch: this._fetchImpl,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
return this._registriesClient.sandboxes.registries;
|
|
356
|
+
}
|
|
305
357
|
/**
|
|
306
358
|
* Internal fetch method that adds authentication headers.
|
|
307
359
|
*
|
|
@@ -616,11 +668,11 @@ export class SandboxClient {
|
|
|
616
668
|
* @param name - Snapshot name.
|
|
617
669
|
* @param dockerImage - Docker image to build from (e.g., "python:3.12-slim").
|
|
618
670
|
* @param fsCapacityBytes - Filesystem capacity in bytes.
|
|
619
|
-
* @param options - Additional options (registry
|
|
671
|
+
* @param options - Additional options (registry ID, timeout).
|
|
620
672
|
* @returns Snapshot in "ready" status.
|
|
621
673
|
*/
|
|
622
674
|
async createSnapshot(name, dockerImage, fsCapacityBytes, options = {}) {
|
|
623
|
-
const { registryId,
|
|
675
|
+
const { registryId, timeout = 60, signal } = options;
|
|
624
676
|
const url = `${this._baseUrl}/snapshots`;
|
|
625
677
|
const payload = {
|
|
626
678
|
name,
|
|
@@ -630,15 +682,6 @@ export class SandboxClient {
|
|
|
630
682
|
if (registryId !== undefined) {
|
|
631
683
|
payload.registry_id = registryId;
|
|
632
684
|
}
|
|
633
|
-
if (registryUrl !== undefined) {
|
|
634
|
-
payload.registry_url = registryUrl;
|
|
635
|
-
}
|
|
636
|
-
if (registryUsername !== undefined) {
|
|
637
|
-
payload.registry_username = registryUsername;
|
|
638
|
-
}
|
|
639
|
-
if (registryPassword !== undefined) {
|
|
640
|
-
payload.registry_password = registryPassword;
|
|
641
|
-
}
|
|
642
685
|
const response = await this._postJson(url, payload, { signal });
|
|
643
686
|
const snapshot = (await response.json());
|
|
644
687
|
return this.waitForSnapshot(snapshot.id, { timeout, signal });
|
package/dist/sandbox/sandbox.cjs
CHANGED
|
@@ -162,15 +162,16 @@ class Sandbox {
|
|
|
162
162
|
this._client = client;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
165
|
+
* Return the dataplane URL.
|
|
166
|
+
*
|
|
167
|
+
* The client does not gate on lifecycle status: a stopped sandbox is resumed
|
|
168
|
+
* by the platform when the dataplane request arrives, so only the presence of
|
|
169
|
+
* a URL is required here. A genuinely not-ready box surfaces the server's
|
|
170
|
+
* LangSmithSandboxNotReadyError from the request itself.
|
|
171
|
+
*
|
|
167
172
|
* @throws LangSmithDataplaneNotConfiguredError if dataplane_url is not configured.
|
|
168
173
|
*/
|
|
169
174
|
requireDataplaneUrl() {
|
|
170
|
-
if (this.status && this.status !== "ready") {
|
|
171
|
-
throw new errors_js_1.LangSmithSandboxNotReadyError(`Sandbox '${this.name}' is not ready (status: ${this.status}). ` +
|
|
172
|
-
"Use waitForSandbox() to wait for the sandbox to become ready.");
|
|
173
|
-
}
|
|
174
175
|
if (!this.dataplane_url) {
|
|
175
176
|
throw new errors_js_1.LangSmithDataplaneNotConfiguredError(`Sandbox '${this.name}' does not have a dataplane_url configured. ` +
|
|
176
177
|
"Runtime operations require a dataplane URL.");
|
|
@@ -64,8 +64,13 @@ export declare class Sandbox {
|
|
|
64
64
|
readonly fs_capacity_bytes?: number;
|
|
65
65
|
private _client;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* Return the dataplane URL.
|
|
68
|
+
*
|
|
69
|
+
* The client does not gate on lifecycle status: a stopped sandbox is resumed
|
|
70
|
+
* by the platform when the dataplane request arrives, so only the presence of
|
|
71
|
+
* a URL is required here. A genuinely not-ready box surfaces the server's
|
|
72
|
+
* LangSmithSandboxNotReadyError from the request itself.
|
|
73
|
+
*
|
|
69
74
|
* @throws LangSmithDataplaneNotConfiguredError if dataplane_url is not configured.
|
|
70
75
|
*/
|
|
71
76
|
private requireDataplaneUrl;
|
package/dist/sandbox/sandbox.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sandbox class for interacting with a specific sandbox instance.
|
|
3
3
|
*/
|
|
4
|
-
import { LangSmithDataplaneNotConfiguredError
|
|
4
|
+
import { LangSmithDataplaneNotConfiguredError } from "./errors.js";
|
|
5
5
|
import { handleSandboxHttpError } from "./helpers.js";
|
|
6
6
|
import { CommandHandle } from "./command_handle.js";
|
|
7
7
|
import { reconnectWsStream, runWsStream } from "./ws_execute.js";
|
|
@@ -159,15 +159,16 @@ export class Sandbox {
|
|
|
159
159
|
this._client = client;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
162
|
+
* Return the dataplane URL.
|
|
163
|
+
*
|
|
164
|
+
* The client does not gate on lifecycle status: a stopped sandbox is resumed
|
|
165
|
+
* by the platform when the dataplane request arrives, so only the presence of
|
|
166
|
+
* a URL is required here. A genuinely not-ready box surfaces the server's
|
|
167
|
+
* LangSmithSandboxNotReadyError from the request itself.
|
|
168
|
+
*
|
|
164
169
|
* @throws LangSmithDataplaneNotConfiguredError if dataplane_url is not configured.
|
|
165
170
|
*/
|
|
166
171
|
requireDataplaneUrl() {
|
|
167
|
-
if (this.status && this.status !== "ready") {
|
|
168
|
-
throw new LangSmithSandboxNotReadyError(`Sandbox '${this.name}' is not ready (status: ${this.status}). ` +
|
|
169
|
-
"Use waitForSandbox() to wait for the sandbox to become ready.");
|
|
170
|
-
}
|
|
171
172
|
if (!this.dataplane_url) {
|
|
172
173
|
throw new LangSmithDataplaneNotConfiguredError(`Sandbox '${this.name}' does not have a dataplane_url configured. ` +
|
|
173
174
|
"Runtime operations require a dataplane URL.");
|
package/dist/sandbox/types.d.ts
CHANGED
|
@@ -477,14 +477,8 @@ export interface CreateSandboxOptions {
|
|
|
477
477
|
* Options for creating a snapshot from a Docker image.
|
|
478
478
|
*/
|
|
479
479
|
export interface CreateSnapshotOptions {
|
|
480
|
-
/** Private registry ID
|
|
480
|
+
/** Private registry ID. */
|
|
481
481
|
registryId?: string;
|
|
482
|
-
/** Registry URL for private images. */
|
|
483
|
-
registryUrl?: string;
|
|
484
|
-
/** Registry username. */
|
|
485
|
-
registryUsername?: string;
|
|
486
|
-
/** Registry password. */
|
|
487
|
-
registryPassword?: string;
|
|
488
482
|
/** Timeout in seconds when waiting for ready. Default: 60. */
|
|
489
483
|
timeout?: number;
|
|
490
484
|
/** AbortSignal for cancellation. */
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
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.Experiments = void 0;
|
|
6
|
-
const resource_js_1 = require("../../core/resource.cjs");
|
|
7
|
-
const path_js_1 = require("../../internal/utils/path.cjs");
|
|
8
|
-
class Experiments extends resource_js_1.APIResource {
|
|
9
|
-
/**
|
|
10
|
-
* Stream grouped and aggregated experiments.
|
|
11
|
-
*/
|
|
12
|
-
grouped(datasetID, body, options) {
|
|
13
|
-
return this._client.post((0, path_js_1.path) `/api/v1/datasets/${datasetID}/experiments/grouped`, { body, ...options });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.Experiments = Experiments;
|
|
@@ -1,23 +0,0 @@
|
|
|
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 Experiments extends APIResource {
|
|
5
|
-
/**
|
|
6
|
-
* Stream grouped and aggregated experiments.
|
|
7
|
-
*/
|
|
8
|
-
grouped(datasetID: string, body: ExperimentGroupedParams, options?: RequestOptions): APIPromise<unknown>;
|
|
9
|
-
}
|
|
10
|
-
export type ExperimentGroupedResponse = unknown;
|
|
11
|
-
export interface ExperimentGroupedParams {
|
|
12
|
-
metadata_keys: Array<string>;
|
|
13
|
-
dataset_version?: string | null;
|
|
14
|
-
experiment_limit?: number;
|
|
15
|
-
filter?: string | null;
|
|
16
|
-
name_contains?: string | null;
|
|
17
|
-
stats_start_time?: string | null;
|
|
18
|
-
tag_value_id?: Array<string> | null;
|
|
19
|
-
use_approx_stats?: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare namespace Experiments {
|
|
22
|
-
export { type ExperimentGroupedResponse as ExperimentGroupedResponse, type ExperimentGroupedParams as ExperimentGroupedParams, };
|
|
23
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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 { path } from '../../internal/utils/path.js';
|
|
5
|
-
export class Experiments extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Stream grouped and aggregated experiments.
|
|
8
|
-
*/
|
|
9
|
-
grouped(datasetID, body, options) {
|
|
10
|
-
return this._client.post(path `/api/v1/datasets/${datasetID}/experiments/grouped`, { body, ...options });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
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.Group = void 0;
|
|
6
|
-
const resource_js_1 = require("../../core/resource.cjs");
|
|
7
|
-
const path_js_1 = require("../../internal/utils/path.cjs");
|
|
8
|
-
class Group extends resource_js_1.APIResource {
|
|
9
|
-
/**
|
|
10
|
-
* Fetch examples for a dataset, and fetch the runs for each example if they are
|
|
11
|
-
* associated with the given session_ids.
|
|
12
|
-
*/
|
|
13
|
-
runs(datasetID, body, options) {
|
|
14
|
-
return this._client.post((0, path_js_1.path) `/api/v1/datasets/${datasetID}/group/runs`, { body, ...options });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.Group = Group;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { APIResource } from '../../core/resource.js';
|
|
2
|
-
import * as RunsAPI from './runs.js';
|
|
3
|
-
import { APIPromise } from '../../core/api-promise.js';
|
|
4
|
-
import { RequestOptions } from '../../internal/request-options.js';
|
|
5
|
-
export declare class Group extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Fetch examples for a dataset, and fetch the runs for each example if they are
|
|
8
|
-
* associated with the given session_ids.
|
|
9
|
-
*/
|
|
10
|
-
runs(datasetID: string, body: GroupRunsParams, options?: RequestOptions): APIPromise<GroupRunsResponse>;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Response for grouped comparison view of dataset examples.
|
|
14
|
-
*
|
|
15
|
-
* Returns dataset examples grouped by a run metadata value (e.g., model='gpt-4').
|
|
16
|
-
* Optional filters are applied to all runs before grouping.
|
|
17
|
-
*
|
|
18
|
-
* Shows:
|
|
19
|
-
*
|
|
20
|
-
* - Which examples were executed with each metadata value
|
|
21
|
-
* - Per-session aggregate statistics for runs on those examples
|
|
22
|
-
* - The actual example data with their associated runs
|
|
23
|
-
*
|
|
24
|
-
* Used for comparing how different sessions performed on the same set of examples.
|
|
25
|
-
*/
|
|
26
|
-
export interface GroupRunsResponse {
|
|
27
|
-
groups: Array<GroupRunsResponse.Group>;
|
|
28
|
-
}
|
|
29
|
-
export declare namespace GroupRunsResponse {
|
|
30
|
-
/**
|
|
31
|
-
* Group of examples with a specific metadata value across multiple sessions.
|
|
32
|
-
*
|
|
33
|
-
* Extends RunGroupBase with:
|
|
34
|
-
*
|
|
35
|
-
* - group_key: metadata value that defines this group
|
|
36
|
-
* - sessions: per-session stats for runs matching this metadata value
|
|
37
|
-
* - examples: shared examples across all sessions (intersection logic) with flat
|
|
38
|
-
* array of runs (each run has session_id field for frontend to determine column)
|
|
39
|
-
* - example_count: unique example count (pagination-aware, same across all
|
|
40
|
-
* sessions due to intersection)
|
|
41
|
-
*
|
|
42
|
-
* Inherited from RunGroupBase:
|
|
43
|
-
*
|
|
44
|
-
* - filter: metadata filter for this group (e.g., "and(eq(is_root, true),
|
|
45
|
-
* and(eq(metadata_key, 'model'), eq(metadata_value, 'gpt-4')))")
|
|
46
|
-
* - count: total run count across all sessions (includes duplicate runs)
|
|
47
|
-
* - total_tokens, total_cost: aggregate across sessions
|
|
48
|
-
* - min_start_time, max_start_time: time range across sessions
|
|
49
|
-
* - latency_p50, latency_p99: aggregate latency stats across sessions
|
|
50
|
-
* - feedback_stats: weighted average feedback across sessions
|
|
51
|
-
*
|
|
52
|
-
* Additional aggregate stats:
|
|
53
|
-
*
|
|
54
|
-
* - prompt_tokens, completion_tokens: separate token counts
|
|
55
|
-
* - prompt_cost, completion_cost: separate costs
|
|
56
|
-
* - error_rate: average error rate
|
|
57
|
-
*/
|
|
58
|
-
interface Group {
|
|
59
|
-
example_count: number;
|
|
60
|
-
examples: Array<RunsAPI.ExampleWithRunsCh>;
|
|
61
|
-
filter: string;
|
|
62
|
-
group_key: string | number;
|
|
63
|
-
sessions: Array<Group.Session>;
|
|
64
|
-
completion_cost?: string | null;
|
|
65
|
-
completion_tokens?: number | null;
|
|
66
|
-
count?: number | null;
|
|
67
|
-
error_rate?: number | null;
|
|
68
|
-
feedback_stats?: {
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
} | null;
|
|
71
|
-
latency_p50?: number | null;
|
|
72
|
-
latency_p99?: number | null;
|
|
73
|
-
max_start_time?: string | null;
|
|
74
|
-
min_start_time?: string | null;
|
|
75
|
-
prompt_cost?: string | null;
|
|
76
|
-
prompt_tokens?: number | null;
|
|
77
|
-
total_cost?: string | null;
|
|
78
|
-
total_tokens?: number | null;
|
|
79
|
-
}
|
|
80
|
-
namespace Group {
|
|
81
|
-
/**
|
|
82
|
-
* TracerSession stats filtered to runs matching a specific metadata value.
|
|
83
|
-
*
|
|
84
|
-
* Extends TracerSession with:
|
|
85
|
-
*
|
|
86
|
-
* - example_count: unique examples (vs run_count = total runs including
|
|
87
|
-
* duplicates)
|
|
88
|
-
* - filter: ClickHouse filter for fetching runs in this session/group
|
|
89
|
-
* - min/max_start_time: time range for runs in this session/group
|
|
90
|
-
*/
|
|
91
|
-
interface Session {
|
|
92
|
-
id: string;
|
|
93
|
-
filter: string;
|
|
94
|
-
tenant_id: string;
|
|
95
|
-
completion_cost?: string | null;
|
|
96
|
-
completion_tokens?: number | null;
|
|
97
|
-
default_dataset_id?: string | null;
|
|
98
|
-
description?: string | null;
|
|
99
|
-
end_time?: string | null;
|
|
100
|
-
error_rate?: number | null;
|
|
101
|
-
example_count?: number | null;
|
|
102
|
-
experiment_progress?: Session.ExperimentProgress | null;
|
|
103
|
-
extra?: {
|
|
104
|
-
[key: string]: unknown;
|
|
105
|
-
} | null;
|
|
106
|
-
feedback_stats?: {
|
|
107
|
-
[key: string]: unknown;
|
|
108
|
-
} | null;
|
|
109
|
-
first_token_p50?: number | null;
|
|
110
|
-
first_token_p99?: number | null;
|
|
111
|
-
last_run_start_time?: string | null;
|
|
112
|
-
last_run_start_time_live?: string | null;
|
|
113
|
-
latency_p50?: number | null;
|
|
114
|
-
latency_p99?: number | null;
|
|
115
|
-
max_start_time?: string | null;
|
|
116
|
-
min_start_time?: string | null;
|
|
117
|
-
name?: string;
|
|
118
|
-
prompt_cost?: string | null;
|
|
119
|
-
prompt_tokens?: number | null;
|
|
120
|
-
reference_dataset_id?: string | null;
|
|
121
|
-
run_count?: number | null;
|
|
122
|
-
run_facets?: Array<{
|
|
123
|
-
[key: string]: unknown;
|
|
124
|
-
}> | null;
|
|
125
|
-
session_feedback_stats?: {
|
|
126
|
-
[key: string]: unknown;
|
|
127
|
-
} | null;
|
|
128
|
-
start_time?: string;
|
|
129
|
-
streaming_rate?: number | null;
|
|
130
|
-
test_run_number?: number | null;
|
|
131
|
-
total_cost?: string | null;
|
|
132
|
-
total_tokens?: number | null;
|
|
133
|
-
trace_tier?: 'longlived' | 'shortlived' | null;
|
|
134
|
-
}
|
|
135
|
-
namespace Session {
|
|
136
|
-
interface ExperimentProgress {
|
|
137
|
-
evaluator_progress: {
|
|
138
|
-
[key: string]: number;
|
|
139
|
-
};
|
|
140
|
-
expected_run_count: number;
|
|
141
|
-
run_progress: number;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
export interface GroupRunsParams {
|
|
147
|
-
group_by: 'run_metadata' | 'example_metadata';
|
|
148
|
-
metadata_key: string;
|
|
149
|
-
session_ids: Array<string>;
|
|
150
|
-
filters?: {
|
|
151
|
-
[key: string]: Array<string>;
|
|
152
|
-
} | null;
|
|
153
|
-
limit?: number;
|
|
154
|
-
offset?: number;
|
|
155
|
-
per_group_limit?: number;
|
|
156
|
-
preview?: boolean;
|
|
157
|
-
}
|
|
158
|
-
export declare namespace Group {
|
|
159
|
-
export { type GroupRunsResponse as GroupRunsResponse, type GroupRunsParams as GroupRunsParams };
|
|
160
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
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 { path } from '../../internal/utils/path.js';
|
|
5
|
-
export class Group extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Fetch examples for a dataset, and fetch the runs for each example if they are
|
|
8
|
-
* associated with the given session_ids.
|
|
9
|
-
*/
|
|
10
|
-
runs(datasetID, body, options) {
|
|
11
|
-
return this._client.post(path `/api/v1/datasets/${datasetID}/group/runs`, { body, ...options });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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.Insights = void 0;
|
|
6
|
-
const resource_js_1 = require("../../core/resource.cjs");
|
|
7
|
-
const pagination_js_1 = require("../../core/pagination.cjs");
|
|
8
|
-
const path_js_1 = require("../../internal/utils/path.cjs");
|
|
9
|
-
class Insights extends resource_js_1.APIResource {
|
|
10
|
-
/**
|
|
11
|
-
* Create an insights job.
|
|
12
|
-
*/
|
|
13
|
-
create(sessionID, body, options) {
|
|
14
|
-
return this._client.post((0, path_js_1.path) `/api/v1/sessions/${sessionID}/insights`, { body, ...options });
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Update a session cluster job.
|
|
18
|
-
*/
|
|
19
|
-
update(jobID, params, options) {
|
|
20
|
-
const { session_id, ...body } = params;
|
|
21
|
-
return this._client.patch((0, path_js_1.path) `/api/v1/sessions/${session_id}/insights/${jobID}`, { body, ...options });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get all clusters for a session.
|
|
25
|
-
*/
|
|
26
|
-
list(sessionID, query = {}, options) {
|
|
27
|
-
return this._client.getAPIList((0, path_js_1.path) `/api/v1/sessions/${sessionID}/insights`, (pagination_js_1.OffsetPaginationInsightsClusteringJobs), { query, ...options });
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Delete a session cluster job.
|
|
31
|
-
*/
|
|
32
|
-
delete(jobID, params, options) {
|
|
33
|
-
const { session_id } = params;
|
|
34
|
-
return this._client.delete((0, path_js_1.path) `/api/v1/sessions/${session_id}/insights/${jobID}`, options);
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Get a specific cluster job for a session.
|
|
38
|
-
*/
|
|
39
|
-
retrieveJob(jobID, params, options) {
|
|
40
|
-
const { session_id } = params;
|
|
41
|
-
return this._client.get((0, path_js_1.path) `/api/v1/sessions/${session_id}/insights/${jobID}`, options);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get all runs for a cluster job, optionally filtered by cluster.
|
|
45
|
-
*/
|
|
46
|
-
retrieveRuns(jobID, params, options) {
|
|
47
|
-
const { session_id, ...query } = params;
|
|
48
|
-
return this._client.get((0, path_js_1.path) `/api/v1/sessions/${session_id}/insights/${jobID}/runs`, {
|
|
49
|
-
query,
|
|
50
|
-
...options,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.Insights = Insights;
|