langsmith 0.8.3 → 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 (38) 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 -820
  26. package/dist/_openapi_client/resources/runs.js +1 -67
  27. package/dist/_openapi_client/resources/traces.d.ts +2 -2
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/run_trees.cjs +8 -0
  32. package/dist/run_trees.js +8 -0
  33. package/dist/utils/constants.cjs +1 -1
  34. package/dist/utils/constants.d.ts +1 -1
  35. package/dist/utils/constants.js +1 -1
  36. package/dist/wrappers/openai.cjs +6 -0
  37. package/dist/wrappers/openai.js +6 -0
  38. package/package.json +6 -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';
@@ -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.3";
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.3";
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.3";
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.3",
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": [
@@ -478,7 +478,11 @@
478
478
  "js-yaml": "^4.1.1",
479
479
  "vite": "^7.3.2",
480
480
  "form-data": "4.0.6",
481
- "langsmith": "0.6.0"
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"
482
486
  }
483
487
  },
484
488
  "browser": {