langsmith 0.8.2 → 0.8.4

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.
Files changed (41) hide show
  1. package/dist/_openapi_client/client.cjs +9 -1
  2. package/dist/_openapi_client/client.d.ts +5 -2
  3. package/dist/_openapi_client/client.js +9 -1
  4. package/dist/_openapi_client/resources/datasets/experiment-runs.d.ts +2 -2
  5. package/dist/_openapi_client/resources/index.cjs +4 -2
  6. package/dist/_openapi_client/resources/index.d.ts +2 -1
  7. package/dist/_openapi_client/resources/index.js +2 -1
  8. package/dist/_openapi_client/resources/issues.d.ts +7 -1
  9. package/dist/_openapi_client/resources/public/public.cjs +54 -0
  10. package/dist/_openapi_client/resources/public/public.d.ts +9 -0
  11. package/dist/_openapi_client/resources/public/public.js +17 -0
  12. package/dist/_openapi_client/resources/public/runs.cjs +56 -0
  13. package/dist/_openapi_client/resources/public/runs.d.ts +76 -0
  14. package/dist/_openapi_client/resources/public/runs.js +52 -0
  15. package/dist/_openapi_client/resources/runs/index.cjs +9 -0
  16. package/dist/_openapi_client/resources/runs/index.d.ts +2 -0
  17. package/dist/_openapi_client/resources/runs/index.js +4 -0
  18. package/dist/_openapi_client/resources/runs/runs.cjs +128 -0
  19. package/dist/_openapi_client/resources/runs/runs.d.ts +854 -0
  20. package/dist/_openapi_client/resources/runs/runs.js +91 -0
  21. package/dist/_openapi_client/resources/runs/share.cjs +42 -0
  22. package/dist/_openapi_client/resources/runs/share.d.ts +50 -0
  23. package/dist/_openapi_client/resources/runs/share.js +38 -0
  24. package/dist/_openapi_client/resources/runs.cjs +15 -69
  25. package/dist/_openapi_client/resources/runs.d.ts +1 -819
  26. package/dist/_openapi_client/resources/runs.js +1 -67
  27. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +8 -0
  28. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +1 -0
  29. package/dist/_openapi_client/resources/threads.d.ts +16 -1
  30. package/dist/_openapi_client/resources/traces.d.ts +2 -2
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/run_trees.cjs +8 -0
  35. package/dist/run_trees.js +8 -0
  36. package/dist/utils/constants.cjs +1 -1
  37. package/dist/utils/constants.d.ts +1 -1
  38. package/dist/utils/constants.js +1 -1
  39. package/dist/wrappers/openai.cjs +6 -0
  40. package/dist/wrappers/openai.js +6 -0
  41. package/package.json +8 -2
@@ -1,69 +1,3 @@
1
1
  // @ts-nocheck
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- import { APIResource } from '../core/resource.js';
4
- import { ItemsCursorPostPagination, } from '../core/pagination.js';
5
- import { buildHeaders } from '../internal/headers.js';
6
- import { path } from '../internal/utils/path.js';
7
- export class Runs extends APIResource {
8
- constructor() {
9
- super(...arguments);
10
- Object.defineProperty(this, "retrieve", {
11
- enumerable: true,
12
- configurable: true,
13
- writable: true,
14
- value: this.retrieveV2
15
- });
16
- Object.defineProperty(this, "query", {
17
- enumerable: true,
18
- configurable: true,
19
- writable: true,
20
- value: this.queryV2
21
- });
22
- }
23
- /**
24
- * **Alpha:** The request and response contract may change; Returns a paginated
25
- * list of runs for the given projects within min/max start_time. Supports filters,
26
- * cursor pagination, and `selects` to select fields to return.
27
- *
28
- * @example
29
- * ```ts
30
- * // Automatically fetches more pages as needed.
31
- * for await (const run of client.runs.queryV2()) {
32
- * // ...
33
- * }
34
- * ```
35
- */
36
- queryV2(params, options) {
37
- const { Accept, ...body } = params;
38
- return this._client.getAPIList('/v2/runs/query', (ItemsCursorPostPagination), {
39
- body,
40
- method: 'post',
41
- ...options,
42
- headers: buildHeaders([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
43
- });
44
- }
45
- /**
46
- * **Alpha:** The request and response contract may change; Returns one run by ID
47
- * for the given session and start_time. Use the `selects` query parameter
48
- * (repeatable) to select fields to return.
49
- *
50
- * @example
51
- * ```ts
52
- * const run = await client.runs.retrieveV2(
53
- * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
54
- * {
55
- * project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
56
- * start_time: '2019-12-27T18:11:19.117Z',
57
- * },
58
- * );
59
- * ```
60
- */
61
- retrieveV2(runID, params, options) {
62
- const { Accept, ...query } = params;
63
- return this._client.get(path `/v2/runs/${runID}`, {
64
- query,
65
- ...options,
66
- headers: buildHeaders([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
67
- });
68
- }
69
- }
3
+ export * from './runs/index.js';
@@ -68,6 +68,14 @@ export interface BoxCreateParams {
68
68
  mem_bytes?: number;
69
69
  mount_config?: BoxCreateParams.MountConfig;
70
70
  name?: string;
71
+ /**
72
+ * PreserveMemoryOnStop, when true, suspends the sandbox's memory on a voluntary
73
+ * stop (idle timeout or explicit stop) so the next start resumes from where it
74
+ * left off. Default false discards memory and keeps only the filesystem, so the
75
+ * next start is a cold boot. Restarts triggered by infrastructure maintenance
76
+ * always preserve memory regardless of this setting.
77
+ */
78
+ preserve_memory_on_stop?: boolean;
71
79
  proxy_config?: BoxCreateParams.ProxyConfig;
72
80
  /**
73
81
  * RestoreMemory selects how the sandbox handles a snapshot's captured memory:
@@ -26,6 +26,7 @@ export interface SandboxResponse {
26
26
  mem_bytes?: number;
27
27
  mount_config?: SandboxResponse.MountConfig;
28
28
  name?: string;
29
+ preserve_memory_on_stop?: boolean;
29
30
  proxy_config?: SandboxResponse.ProxyConfig;
30
31
  size_class?: string;
31
32
  snapshot_id?: string;
@@ -457,6 +457,11 @@ export interface ThreadTrace {
457
457
  * is still in progress. Omitted unless included in `selects`.
458
458
  */
459
459
  end_time?: string;
460
+ /**
461
+ * `error` is the full root run error message when the run failed. Omitted unless
462
+ * included in `selects`.
463
+ */
464
+ error?: string;
460
465
  /**
461
466
  * `error_preview` is a short error summary when the run failed. Omitted unless
462
467
  * included in `selects`.
@@ -468,6 +473,11 @@ export interface ThreadTrace {
468
473
  * in `selects`.
469
474
  */
470
475
  first_token_time?: string;
476
+ /**
477
+ * `inputs` is the full root run input payload. Omitted unless included in
478
+ * `selects`.
479
+ */
480
+ inputs?: unknown;
471
481
  /**
472
482
  * `inputs_preview` is a truncated text preview of inputs. Omitted unless included
473
483
  * in `selects`.
@@ -491,6 +501,11 @@ export interface ThreadTrace {
491
501
  * included in `selects`.
492
502
  */
493
503
  op?: number;
504
+ /**
505
+ * `outputs` is the full root run output payload. Omitted unless included in
506
+ * `selects`.
507
+ */
508
+ outputs?: unknown;
494
509
  /**
495
510
  * `outputs_preview` is a truncated text preview of outputs. Omitted unless
496
511
  * included in `selects`.
@@ -614,7 +629,7 @@ export interface ThreadListTracesParams extends ItemsCursorGetPaginationParams {
614
629
  * Properties not listed are omitted from each trace object; `trace_id` is always
615
630
  * returned.
616
631
  */
617
- selects?: Array<'THREAD_ID' | 'TRACE_ID' | 'OP' | 'PROMPT_TOKENS' | 'COMPLETION_TOKENS' | 'TOTAL_TOKENS' | 'START_TIME' | 'END_TIME' | 'LATENCY' | 'FIRST_TOKEN_TIME' | 'INPUTS_PREVIEW' | 'OUTPUTS_PREVIEW' | 'PROMPT_COST' | 'COMPLETION_COST' | 'TOTAL_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'NAME' | 'ERROR_PREVIEW'>;
632
+ selects?: Array<'THREAD_ID' | 'TRACE_ID' | 'OP' | 'PROMPT_TOKENS' | 'COMPLETION_TOKENS' | 'TOTAL_TOKENS' | 'START_TIME' | 'END_TIME' | 'LATENCY' | 'FIRST_TOKEN_TIME' | 'INPUTS_PREVIEW' | 'OUTPUTS_PREVIEW' | 'INPUTS' | 'OUTPUTS' | 'ERROR' | 'PROMPT_COST' | 'COMPLETION_COST' | 'TOTAL_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'NAME' | 'ERROR_PREVIEW'>;
618
633
  }
619
634
  export interface ThreadQueryParams extends ItemsCursorPostPaginationParams {
620
635
  /**
@@ -1,5 +1,5 @@
1
1
  import { APIResource } from '../core/resource.js';
2
- import * as RunsAPI from './runs.js';
2
+ import * as RunsAPI from './runs/runs.js';
3
3
  import { APIPromise } from '../core/api-promise.js';
4
4
  import { ItemsCursorPostPagination, type ItemsCursorPostPaginationParams, PagePromise } from '../core/pagination.js';
5
5
  import { RequestOptions } from '../internal/request-options.js';
@@ -136,7 +136,7 @@ export interface TraceQueryParams extends ItemsCursorPostPaginationParams {
136
136
  * `trace_aggregates`; everything else appears under `root_run`. If omitted, only
137
137
  * `id` is returned on `root_run`.
138
138
  */
139
- selects?: Array<'ID' | 'NAME' | 'RUN_TYPE' | 'STATUS' | 'START_TIME' | 'END_TIME' | 'LATENCY_SECONDS' | 'FIRST_TOKEN_TIME' | 'ERROR' | 'ERROR_PREVIEW' | 'EXTRA' | 'METADATA' | 'EVENTS' | 'INPUTS' | 'INPUTS_PREVIEW' | 'OUTPUTS' | 'OUTPUTS_PREVIEW' | 'MANIFEST' | 'PARENT_RUN_IDS' | 'PROJECT_ID' | 'TRACE_ID' | 'THREAD_ID' | 'DOTTED_ORDER' | 'IS_ROOT' | 'REFERENCE_EXAMPLE_ID' | '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' | 'APP_PATH' | 'ATTACHMENTS' | 'THREAD_EVALUATION_TIME' | 'IS_IN_DATASET' | 'SHARE_URL' | 'FEEDBACK_STATS'>;
139
+ selects?: Array<RunsAPI.RunSelectField>;
140
140
  /**
141
141
  * `trace_filter` narrows results to traces whose root run matches this LangSmith
142
142
  * filter expression. This filter targets root runs only — `is_root = true` is
package/dist/index.cjs CHANGED
@@ -34,6 +34,6 @@ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, g
34
34
  Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_js_1.RateLimitError; } });
35
35
  Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_js_1.InternalServerError; } });
36
36
  // Update using pnpm bump-version
37
- exports.__version__ = "0.8.2";
37
+ exports.__version__ = "0.8.4";
38
38
  // Metadata key to hide a traced run from LangSmith's Messages View.
39
39
  exports.LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
package/dist/index.d.ts CHANGED
@@ -7,5 +7,5 @@ export { uuid7, uuid7FromTime } from "./uuid.js";
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.8.2";
10
+ export declare const __version__ = "0.8.4";
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.8.2";
10
+ export const __version__ = "0.8.4";
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";
@@ -989,9 +989,17 @@ function _getWriteReplicasFromEnv() {
989
989
  `expected string, got ${typeof item.api_key}`);
990
990
  continue;
991
991
  }
992
+ if (item.project_name !== undefined &&
993
+ item.project_name !== null &&
994
+ typeof item.project_name !== "string") {
995
+ console.warn(`Invalid project_name type in LANGSMITH_RUNS_ENDPOINTS: ` +
996
+ `expected string, got ${typeof item.project_name}`);
997
+ continue;
998
+ }
992
999
  replicas.push({
993
1000
  apiUrl: item.api_url.replace(/\/$/, ""),
994
1001
  apiKey: item.api_key,
1002
+ projectName: item.project_name ?? undefined,
995
1003
  });
996
1004
  }
997
1005
  return replicas;
package/dist/run_trees.js CHANGED
@@ -982,9 +982,17 @@ function _getWriteReplicasFromEnv() {
982
982
  `expected string, got ${typeof item.api_key}`);
983
983
  continue;
984
984
  }
985
+ if (item.project_name !== undefined &&
986
+ item.project_name !== null &&
987
+ typeof item.project_name !== "string") {
988
+ console.warn(`Invalid project_name type in LANGSMITH_RUNS_ENDPOINTS: ` +
989
+ `expected string, got ${typeof item.project_name}`);
990
+ continue;
991
+ }
985
992
  replicas.push({
986
993
  apiUrl: item.api_url.replace(/\/$/, ""),
987
994
  apiKey: item.api_key,
995
+ projectName: item.project_name ?? undefined,
988
996
  });
989
997
  }
990
998
  return replicas;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._MIN_BACKEND_VERSION = void 0;
4
- exports._MIN_BACKEND_VERSION = "0.16.13rc1";
4
+ exports._MIN_BACKEND_VERSION = "0.16.14rc1";
@@ -1 +1 @@
1
- export declare const _MIN_BACKEND_VERSION = "0.16.13rc1";
1
+ export declare const _MIN_BACKEND_VERSION = "0.16.14rc1";
@@ -1 +1 @@
1
- export const _MIN_BACKEND_VERSION = "0.16.13rc1";
1
+ export const _MIN_BACKEND_VERSION = "0.16.14rc1";
@@ -244,7 +244,13 @@ const getChatModelInvocationParamsFn = (provider, prepopulatedInvocationParams,
244
244
  if (useResponsesApi) {
245
245
  ls_invocation_params.use_responses_api = true;
246
246
  }
247
+ const requestMetadata = typeof params.metadata === "object" &&
248
+ params.metadata !== null &&
249
+ !Array.isArray(params.metadata)
250
+ ? params.metadata
251
+ : {};
247
252
  return {
253
+ ...requestMetadata,
248
254
  ls_provider: provider,
249
255
  ls_model_type: "chat",
250
256
  ls_model_name: params.model,
@@ -241,7 +241,13 @@ const getChatModelInvocationParamsFn = (provider, prepopulatedInvocationParams,
241
241
  if (useResponsesApi) {
242
242
  ls_invocation_params.use_responses_api = true;
243
243
  }
244
+ const requestMetadata = typeof params.metadata === "object" &&
245
+ params.metadata !== null &&
246
+ !Array.isArray(params.metadata)
247
+ ? params.metadata
248
+ : {};
244
249
  return {
250
+ ...requestMetadata,
245
251
  ls_provider: provider,
246
252
  ls_model_type: "chat",
247
253
  ls_model_name: params.model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
5
5
  "packageManager": "pnpm@10.33.0",
6
6
  "files": [
@@ -476,7 +476,13 @@
476
476
  "pnpm": {
477
477
  "overrides": {
478
478
  "js-yaml": "^4.1.1",
479
- "vite": "^7.3.2"
479
+ "vite": "^7.3.2",
480
+ "form-data": "4.0.6",
481
+ "langsmith": "0.6.0",
482
+ "@babel/core": "^7.29.7",
483
+ "esbuild": "^0.28.1",
484
+ "markdown-it": "^14.3.0",
485
+ "uuid": "^11.1.1"
480
486
  }
481
487
  },
482
488
  "browser": {