langsmith 0.8.3 → 0.8.5

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 (57) 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/client.cjs +47 -7
  29. package/dist/client.d.ts +17 -2
  30. package/dist/client.js +47 -7
  31. package/dist/evaluation/_runner.cjs +13 -2
  32. package/dist/evaluation/_runner.js +13 -2
  33. package/dist/evaluation/evaluate_comparative.cjs +14 -6
  34. package/dist/evaluation/evaluate_comparative.d.ts +4 -1
  35. package/dist/evaluation/evaluate_comparative.js +13 -6
  36. package/dist/index.cjs +3 -2
  37. package/dist/index.d.ts +3 -3
  38. package/dist/index.js +2 -2
  39. package/dist/run_trees.cjs +38 -10
  40. package/dist/run_trees.d.ts +3 -1
  41. package/dist/run_trees.js +38 -10
  42. package/dist/utils/constants.cjs +1 -1
  43. package/dist/utils/constants.d.ts +1 -1
  44. package/dist/utils/constants.js +1 -1
  45. package/dist/utils/jestlike/globals.cjs +11 -3
  46. package/dist/utils/jestlike/globals.js +11 -3
  47. package/dist/utils/jestlike/index.cjs +3 -0
  48. package/dist/utils/jestlike/index.js +3 -0
  49. package/dist/utils/v2_migration.cjs +56 -0
  50. package/dist/utils/v2_migration.d.ts +7 -0
  51. package/dist/utils/v2_migration.js +52 -0
  52. package/dist/uuid.cjs +22 -2
  53. package/dist/uuid.d.ts +8 -0
  54. package/dist/uuid.js +19 -0
  55. package/dist/wrappers/openai.cjs +6 -0
  56. package/dist/wrappers/openai.js +6 -0
  57. package/package.json +6 -2
@@ -0,0 +1,854 @@
1
+ import { APIResource } from '../../core/resource.js';
2
+ import * as ShareAPI from './share.js';
3
+ import { Share, ShareCreateParams, ShareCreateResponse, ShareDeleteParams } from './share.js';
4
+ import { APIPromise } from '../../core/api-promise.js';
5
+ import { ItemsCursorPostPagination, type ItemsCursorPostPaginationParams, PagePromise } from '../../core/pagination.js';
6
+ import { RequestOptions } from '../../internal/request-options.js';
7
+ export declare class Runs extends APIResource {
8
+ share: ShareAPI.Share;
9
+ /**
10
+ * Returns the URL to view a specific run in the LangSmith UI. The caller must
11
+ * supply the run's project_id and trace_id as query parameters; start_time is
12
+ * optional.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const response = await client.runs.getURL(
17
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
18
+ * { project_id: 'project_id', trace_id: 'trace_id' },
19
+ * );
20
+ * ```
21
+ */
22
+ getURL(runID: string, query: RunGetURLParams, options?: RequestOptions): APIPromise<RunGetURLResponse>;
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: RunQueryV2Params, options?: RequestOptions): PagePromise<RunsItemsCursorPostPagination, Run>;
37
+ /**
38
+ * **Alpha:** The request and response contract may change; Returns one run by ID
39
+ * for the given session. Use the `selects` query parameter (repeatable) to select
40
+ * fields to return.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * const run = await client.runs.retrieveV2(
45
+ * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
46
+ * { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
47
+ * );
48
+ * ```
49
+ */
50
+ retrieveV2(runID: string, params: RunRetrieveV2Params, options?: RequestOptions): APIPromise<Run>;
51
+ retrieve: (runID: string, params: RunRetrieveV2Params, options?: RequestOptions) => APIPromise<Run>;
52
+ query: (params: RunQueryV2Params, options?: RequestOptions) => PagePromise<RunsItemsCursorPostPagination, Run>;
53
+ }
54
+ export type RunsItemsCursorPostPagination = ItemsCursorPostPagination<Run>;
55
+ export interface ResponseBodyForRunsGenerateQuery {
56
+ feedback_urls: {
57
+ [key: string]: string;
58
+ };
59
+ filter: string;
60
+ }
61
+ export interface Run {
62
+ /**
63
+ * `id` is this run's UUID.
64
+ */
65
+ id?: string;
66
+ /**
67
+ * `app_path` identifies the application code location that produced this run, if
68
+ * recorded.
69
+ */
70
+ app_path?: string;
71
+ /**
72
+ * `attachments` maps each attachment file name to a pre-signed HTTPS download URL.
73
+ */
74
+ attachments?: {
75
+ [key: string]: string;
76
+ };
77
+ /**
78
+ * `completion_cost` is estimated USD cost for the completion.
79
+ */
80
+ completion_cost?: number;
81
+ /**
82
+ * `completion_cost_details` is the per-category USD breakdown of
83
+ * `completion_cost`. Categories mirror `completion_token_details`. Returned only
84
+ * when the `COMPLETION_COST_DETAILS` field is requested.
85
+ */
86
+ completion_cost_details?: Run.CompletionCostDetails;
87
+ /**
88
+ * `completion_token_details` is the per-category breakdown of `completion_tokens`.
89
+ * Category names are model-specific (for example `reasoning`, `audio`). Returned
90
+ * only when the `COMPLETION_TOKEN_DETAILS` field is requested.
91
+ */
92
+ completion_token_details?: Run.CompletionTokenDetails;
93
+ /**
94
+ * `completion_tokens` is the completion-side token count.
95
+ */
96
+ completion_tokens?: number;
97
+ /**
98
+ * `dotted_order` is the hierarchical ordering key for trace trees.
99
+ */
100
+ dotted_order?: string;
101
+ /**
102
+ * `end_time` is when the run ended (RFC3339 date-time). JSON null if the run has
103
+ * not finished yet.
104
+ */
105
+ end_time?: string;
106
+ /**
107
+ * `error` is the error message when `status` indicates failure.
108
+ */
109
+ error?: string;
110
+ /**
111
+ * `error_preview` is a truncated plain-text error snippet.
112
+ */
113
+ error_preview?: string;
114
+ /**
115
+ * `events` is the ordered list of run events (for example streaming tokens).
116
+ */
117
+ events?: Array<Run.Event>;
118
+ /**
119
+ * `extra` is additional runtime JSON attached to the run.
120
+ */
121
+ extra?: {
122
+ [key: string]: unknown;
123
+ };
124
+ /**
125
+ * `feedback_stats` aggregates feedback scores keyed by feedback key.
126
+ */
127
+ feedback_stats?: {
128
+ [key: string]: Run.FeedbackStats;
129
+ };
130
+ /**
131
+ * `first_token_time` is when the first output token was produced (RFC3339
132
+ * date-time), when recorded for streamed runs.
133
+ */
134
+ first_token_time?: string;
135
+ /**
136
+ * `inputs` is the run input payload (arbitrary JSON object).
137
+ */
138
+ inputs?: {
139
+ [key: string]: unknown;
140
+ };
141
+ /**
142
+ * `inputs_preview` is a truncated plain-text preview of inputs.
143
+ */
144
+ inputs_preview?: string;
145
+ /**
146
+ * `is_in_dataset` is true when this run is linked to a dataset example.
147
+ */
148
+ is_in_dataset?: boolean;
149
+ /**
150
+ * `is_root` is true when this run has no parent (it is the trace root).
151
+ */
152
+ is_root?: boolean;
153
+ /**
154
+ * `latency_seconds` is wall-clock duration from start to end in seconds.
155
+ */
156
+ latency_seconds?: number;
157
+ /**
158
+ * `manifest` is the serialized configuration of the traced component (for example
159
+ * the model parameters, prompt template, or pipeline definition), when recorded.
160
+ */
161
+ manifest?: {
162
+ [key: string]: unknown;
163
+ };
164
+ /**
165
+ * `metadata` is arbitrary user-defined JSON metadata.
166
+ */
167
+ metadata?: {
168
+ [key: string]: unknown;
169
+ };
170
+ /**
171
+ * `name` is a human-readable label for the run (for example the model name,
172
+ * function name, or step name chosen when the run was traced).
173
+ */
174
+ name?: string;
175
+ /**
176
+ * `outputs` is the run output payload (arbitrary JSON object).
177
+ */
178
+ outputs?: {
179
+ [key: string]: unknown;
180
+ };
181
+ /**
182
+ * `outputs_preview` is a truncated plain-text preview of outputs.
183
+ */
184
+ outputs_preview?: string;
185
+ /**
186
+ * `parent_run_ids` lists ancestor run UUIDs from the trace root down to the direct
187
+ * parent.
188
+ */
189
+ parent_run_ids?: Array<string>;
190
+ /**
191
+ * `price_model_id` identifies the pricing model UUID used for cost estimates, when
192
+ * recorded.
193
+ */
194
+ price_model_id?: string;
195
+ /**
196
+ * `project_id` is the tracing project UUID this run was logged to.
197
+ */
198
+ project_id?: string;
199
+ /**
200
+ * `prompt_cost` is estimated USD cost for the prompt.
201
+ */
202
+ prompt_cost?: number;
203
+ /**
204
+ * `prompt_cost_details` is the per-category USD breakdown of `prompt_cost`.
205
+ * Categories mirror `prompt_token_details`. Returned only when the
206
+ * `PROMPT_COST_DETAILS` field is requested.
207
+ */
208
+ prompt_cost_details?: Run.PromptCostDetails;
209
+ /**
210
+ * `prompt_token_details` is the per-category breakdown of `prompt_tokens`.
211
+ * Category names are model-specific (for example `cache_read`, `cache_write`).
212
+ * Returned only when the `PROMPT_TOKEN_DETAILS` field is requested.
213
+ */
214
+ prompt_token_details?: Run.PromptTokenDetails;
215
+ /**
216
+ * `prompt_tokens` is the prompt-side token count.
217
+ */
218
+ prompt_tokens?: number;
219
+ /**
220
+ * `reference_dataset_id` is the dataset UUID for the reference example, if any.
221
+ */
222
+ reference_dataset_id?: string;
223
+ /**
224
+ * `reference_example_id` is the dataset example UUID this run was compared
225
+ * against, if any.
226
+ */
227
+ reference_example_id?: string;
228
+ /**
229
+ * `run_type` identifies what kind of operation this run represents (for example an
230
+ * LLM call, a tool invocation, or a chain step). See the `RunType` enum for
231
+ * allowed values.
232
+ */
233
+ run_type?: RunType;
234
+ /**
235
+ * `share_url` is the fully-qualified URL of this run's public view, rooted at the
236
+ * deployment's LangSmith app origin (for example
237
+ * `https://smith.langchain.com/public/4f7a1b2c-8d9e-4a0b-9c1d-2e3f4a5b6c7d/r`). It
238
+ * is returned only when `SHARE_URL` is included in `selects`, and only when the
239
+ * run has been explicitly shared; the URL remains stable until the run is
240
+ * unshared. Anyone with this URL can view the run anonymously, so treat it as a
241
+ * secret and do not log it.
242
+ */
243
+ share_url?: string;
244
+ /**
245
+ * `start_time` is when the run started (RFC3339 date-time).
246
+ */
247
+ start_time?: string;
248
+ /**
249
+ * `status` is the completion status of the run.
250
+ */
251
+ status?: 'SUCCESS' | 'ERROR' | 'PENDING';
252
+ /**
253
+ * `tags` lists user-defined tags on this run.
254
+ */
255
+ tags?: Array<string>;
256
+ /**
257
+ * `thread_evaluation_time` is thread-level evaluation timing (RFC3339 date-time),
258
+ * when recorded.
259
+ */
260
+ thread_evaluation_time?: string;
261
+ /**
262
+ * `thread_id` is the conversation thread UUID this run belongs to, if any.
263
+ */
264
+ thread_id?: string;
265
+ /**
266
+ * `total_cost` is total estimated USD cost (prompt plus completion).
267
+ */
268
+ total_cost?: number;
269
+ /**
270
+ * `total_tokens` is prompt plus completion tokens.
271
+ */
272
+ total_tokens?: number;
273
+ /**
274
+ * `trace_id` is the root trace UUID; for a root run it matches `id`.
275
+ */
276
+ trace_id?: string;
277
+ }
278
+ export declare namespace Run {
279
+ /**
280
+ * `completion_cost_details` is the per-category USD breakdown of
281
+ * `completion_cost`. Categories mirror `completion_token_details`. Returned only
282
+ * when the `COMPLETION_COST_DETAILS` field is requested.
283
+ */
284
+ interface CompletionCostDetails {
285
+ /**
286
+ * `raw` maps each category name to its estimated USD cost.
287
+ */
288
+ raw?: {
289
+ [key: string]: number;
290
+ };
291
+ }
292
+ /**
293
+ * `completion_token_details` is the per-category breakdown of `completion_tokens`.
294
+ * Category names are model-specific (for example `reasoning`, `audio`). Returned
295
+ * only when the `COMPLETION_TOKEN_DETAILS` field is requested.
296
+ */
297
+ interface CompletionTokenDetails {
298
+ /**
299
+ * `raw` maps each category name to its completion-token count.
300
+ */
301
+ raw?: {
302
+ [key: string]: number;
303
+ };
304
+ }
305
+ interface Event {
306
+ /**
307
+ * `kwargs` is the event payload — an opaque JSON object whose shape depends on
308
+ * `name` and on the emitting SDK. For example LangChain emits `{"token": {...}}`
309
+ * for `new_token` events, tool-call start/end details for tool events, and
310
+ * arbitrary user-defined payloads for custom events. Clients should treat `kwargs`
311
+ * as untyped JSON: do not assume specific keys exist for a given `name`, and
312
+ * tolerate additional unknown keys appearing over time.
313
+ */
314
+ kwargs?: unknown;
315
+ /**
316
+ * `name` is the event kind. Common values emitted by the LangChain/LangSmith
317
+ * tracer SDKs include `"start"`, `"end"`, and `"new_token"`, but applications may
318
+ * emit arbitrary strings for their own instrumentation.
319
+ */
320
+ name?: string;
321
+ /**
322
+ * `time` is when the event occurred (RFC3339 date-time with millisecond
323
+ * precision).
324
+ */
325
+ time?: string;
326
+ }
327
+ interface FeedbackStats {
328
+ /**
329
+ * `avg` is the arithmetic mean of numeric feedback scores for this key on the run,
330
+ * or `null` when no numeric score has been recorded (for example purely
331
+ * categorical feedback).
332
+ */
333
+ avg?: number;
334
+ /**
335
+ * `comments` is a sample of human-readable comments attached to feedback points
336
+ * for this key, in no particular order. May be empty; is not exhaustive when many
337
+ * comments exist.
338
+ */
339
+ comments?: Array<string>;
340
+ /**
341
+ * `contains_thread_feedback` is true when at least one feedback point for this key
342
+ * was submitted at the thread level (rather than at an individual run). Always
343
+ * false on responses that already describe a single run in isolation.
344
+ */
345
+ contains_thread_feedback?: boolean;
346
+ /**
347
+ * `errors` is the number of feedback points recorded as errors rather than
348
+ * successful scores (for example an automated evaluator that raised an exception).
349
+ * Defaults to 0 when no errors occurred.
350
+ */
351
+ errors?: number;
352
+ /**
353
+ * `max` is the largest numeric feedback score recorded for this key on the run, or
354
+ * `null` when no numeric score has been recorded.
355
+ */
356
+ max?: number;
357
+ /**
358
+ * `min` is the smallest numeric feedback score recorded for this key on the run,
359
+ * or `null` when no numeric score has been recorded.
360
+ */
361
+ min?: number;
362
+ /**
363
+ * `n` is the number of feedback points recorded for this key on the run. For
364
+ * numeric feedback this is the sample size behind `avg`, `min`, `max`, and
365
+ * `stdev`; for categorical feedback it is the sum of the `values` counts.
366
+ */
367
+ n?: number;
368
+ /**
369
+ * `sources` is a sample of feedback sources for this key. Each entry is either a
370
+ * plain string identifier (for example `"api"`, `"app"`, `"model"`) or a JSON
371
+ * object describing a synthetic source (for example
372
+ * `{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
373
+ * tolerate both shapes.
374
+ */
375
+ sources?: Array<unknown>;
376
+ /**
377
+ * `stdev` is the sample standard deviation of numeric feedback scores for this key
378
+ * on the run, or `null` when it cannot be computed (for example fewer than two
379
+ * numeric scores, or purely categorical feedback).
380
+ */
381
+ stdev?: number;
382
+ /**
383
+ * `values` is the distribution of categorical feedback labels for this key,
384
+ * mapping each label to its occurrence count. Empty (`{}`) for purely numeric
385
+ * feedback.
386
+ */
387
+ values?: {
388
+ [key: string]: number;
389
+ };
390
+ }
391
+ /**
392
+ * `prompt_cost_details` is the per-category USD breakdown of `prompt_cost`.
393
+ * Categories mirror `prompt_token_details`. Returned only when the
394
+ * `PROMPT_COST_DETAILS` field is requested.
395
+ */
396
+ interface PromptCostDetails {
397
+ /**
398
+ * `raw` maps each category name to its estimated USD cost.
399
+ */
400
+ raw?: {
401
+ [key: string]: number;
402
+ };
403
+ }
404
+ /**
405
+ * `prompt_token_details` is the per-category breakdown of `prompt_tokens`.
406
+ * Category names are model-specific (for example `cache_read`, `cache_write`).
407
+ * Returned only when the `PROMPT_TOKEN_DETAILS` field is requested.
408
+ */
409
+ interface PromptTokenDetails {
410
+ /**
411
+ * `raw` maps each category name to its prompt-token count.
412
+ */
413
+ raw?: {
414
+ [key: string]: number;
415
+ };
416
+ }
417
+ }
418
+ export interface RunIngest {
419
+ id?: string;
420
+ dotted_order?: string;
421
+ end_time?: string;
422
+ error?: string;
423
+ events?: Array<{
424
+ [key: string]: unknown;
425
+ }>;
426
+ extra?: {
427
+ [key: string]: unknown;
428
+ };
429
+ input_attachments?: {
430
+ [key: string]: unknown;
431
+ };
432
+ inputs?: {
433
+ [key: string]: unknown;
434
+ };
435
+ name?: string;
436
+ output_attachments?: {
437
+ [key: string]: unknown;
438
+ };
439
+ outputs?: {
440
+ [key: string]: unknown;
441
+ };
442
+ parent_run_id?: string;
443
+ reference_example_id?: string;
444
+ run_type?: 'tool' | 'chain' | 'llm' | 'retriever' | 'embedding' | 'prompt' | 'parser';
445
+ serialized?: {
446
+ [key: string]: unknown;
447
+ };
448
+ session_id?: string;
449
+ session_name?: string;
450
+ start_time?: string;
451
+ status?: string;
452
+ tags?: Array<string>;
453
+ trace_id?: string;
454
+ }
455
+ /**
456
+ * Run schema.
457
+ */
458
+ export interface RunSchema {
459
+ id: string;
460
+ app_path: string;
461
+ dotted_order: string;
462
+ name: string;
463
+ /**
464
+ * Enum for run types.
465
+ */
466
+ run_type: RunTypeEnum;
467
+ session_id: string;
468
+ status: string;
469
+ trace_id: string;
470
+ child_run_ids?: Array<string> | null;
471
+ completion_cost?: string | null;
472
+ completion_cost_details?: {
473
+ [key: string]: string;
474
+ } | null;
475
+ completion_token_details?: {
476
+ [key: string]: number;
477
+ } | null;
478
+ completion_tokens?: number;
479
+ direct_child_run_ids?: Array<string> | null;
480
+ end_time?: string | null;
481
+ error?: string | null;
482
+ events?: Array<{
483
+ [key: string]: unknown;
484
+ }> | null;
485
+ execution_order?: number;
486
+ extra?: {
487
+ [key: string]: unknown;
488
+ } | null;
489
+ feedback_stats?: {
490
+ [key: string]: {
491
+ [key: string]: unknown;
492
+ };
493
+ } | null;
494
+ first_token_time?: string | null;
495
+ in_dataset?: boolean | null;
496
+ inputs?: {
497
+ [key: string]: unknown;
498
+ } | null;
499
+ inputs_preview?: string | null;
500
+ inputs_s3_urls?: {
501
+ [key: string]: unknown;
502
+ } | null;
503
+ last_queued_at?: string | null;
504
+ manifest_id?: string | null;
505
+ manifest_s3_id?: string | null;
506
+ messages?: Array<{
507
+ [key: string]: unknown;
508
+ }> | null;
509
+ outputs?: {
510
+ [key: string]: unknown;
511
+ } | null;
512
+ outputs_preview?: string | null;
513
+ outputs_s3_urls?: {
514
+ [key: string]: unknown;
515
+ } | null;
516
+ parent_run_id?: string | null;
517
+ parent_run_ids?: Array<string> | null;
518
+ price_model_id?: string | null;
519
+ prompt_cost?: string | null;
520
+ prompt_cost_details?: {
521
+ [key: string]: string;
522
+ } | null;
523
+ prompt_token_details?: {
524
+ [key: string]: number;
525
+ } | null;
526
+ prompt_tokens?: number;
527
+ reference_dataset_id?: string | null;
528
+ reference_example_id?: string | null;
529
+ s3_urls?: {
530
+ [key: string]: unknown;
531
+ } | null;
532
+ serialized?: {
533
+ [key: string]: unknown;
534
+ } | null;
535
+ share_token?: string | null;
536
+ start_time?: string;
537
+ tags?: Array<string> | null;
538
+ thread_id?: string | null;
539
+ total_cost?: string | null;
540
+ total_tokens?: number;
541
+ trace_first_received_at?: string | null;
542
+ trace_max_start_time?: string | null;
543
+ trace_min_start_time?: string | null;
544
+ trace_tier?: 'longlived' | 'shortlived' | null;
545
+ trace_upgrade?: boolean;
546
+ ttl_seconds?: number | null;
547
+ }
548
+ export type RunSelectField = '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';
549
+ /**
550
+ * Query params for run stats.
551
+ */
552
+ export interface RunStatsQueryParams {
553
+ id?: Array<string> | null;
554
+ /**
555
+ * Enum for run data source types.
556
+ */
557
+ data_source_type?: RunsFilterDataSourceTypeEnum | null;
558
+ end_time?: string | null;
559
+ error?: boolean | null;
560
+ execution_order?: number | null;
561
+ filter?: string | null;
562
+ /**
563
+ * Group by param for run stats.
564
+ */
565
+ group_by?: RunStatsQueryParams.GroupBy | null;
566
+ groups?: Array<string | null> | null;
567
+ include_details?: boolean;
568
+ is_root?: boolean | null;
569
+ parent_run?: string | null;
570
+ query?: string | null;
571
+ reference_dataset_id?: string | null;
572
+ reference_example?: Array<string> | null;
573
+ /**
574
+ * Enum for run types.
575
+ */
576
+ run_type?: RunTypeEnum | null;
577
+ search_filter?: string | null;
578
+ select?: Array<'run_count' | 'latency_p50' | 'latency_p99' | 'latency_avg' | 'first_token_p50' | 'first_token_p99' | 'total_tokens' | 'prompt_tokens' | 'completion_tokens' | 'median_tokens' | 'completion_tokens_p50' | 'prompt_tokens_p50' | 'tokens_p99' | 'completion_tokens_p99' | 'prompt_tokens_p99' | 'last_run_start_time' | 'feedback_stats' | 'thread_feedback_stats' | 'run_facets' | 'error_rate' | 'streaming_rate' | 'total_cost' | 'prompt_cost' | 'completion_cost' | 'cost_p50' | 'cost_p99' | 'session_feedback_stats' | 'all_run_stats' | 'all_token_stats' | 'group_count' | 'prompt_token_details' | 'completion_token_details' | 'prompt_cost_details' | 'completion_cost_details'> | null;
579
+ session?: Array<string> | null;
580
+ skip_pagination?: boolean | null;
581
+ start_time?: string | null;
582
+ /**
583
+ * Filter runs by trace ID. When set, limit and cursor-based pagination are not
584
+ * applied — all runs in the trace are returned in a single response.
585
+ */
586
+ trace?: string | null;
587
+ trace_filter?: string | null;
588
+ tree_filter?: string | null;
589
+ use_experimental_search?: boolean;
590
+ }
591
+ export declare namespace RunStatsQueryParams {
592
+ /**
593
+ * Group by param for run stats.
594
+ */
595
+ interface GroupBy {
596
+ attribute: 'name' | 'run_type' | 'tag' | 'metadata';
597
+ max_groups?: number;
598
+ path?: string | null;
599
+ }
600
+ }
601
+ export type RunType = 'TOOL' | 'CHAIN' | 'LLM' | 'RETRIEVER' | 'EMBEDDING' | 'PROMPT' | 'PARSER';
602
+ /**
603
+ * Enum for run types.
604
+ */
605
+ export type RunTypeEnum = 'tool' | 'chain' | 'llm' | 'retriever' | 'embedding' | 'prompt' | 'parser';
606
+ /**
607
+ * Enum for run data source types.
608
+ */
609
+ export type RunsFilterDataSourceTypeEnum = 'current' | 'historical' | 'lite' | 'root_lite' | 'runs_feedbacks_rmt_wide';
610
+ export interface RunGetURLResponse {
611
+ url?: string;
612
+ }
613
+ export interface RunGetURLParams {
614
+ /**
615
+ * Project (session) UUID
616
+ */
617
+ project_id: string;
618
+ /**
619
+ * Trace UUID
620
+ */
621
+ trace_id: string;
622
+ /**
623
+ * Run start time in RFC3339 format; omit if unknown
624
+ */
625
+ start_time?: string;
626
+ }
627
+ export interface RunQueryV2Params extends ItemsCursorPostPaginationParams {
628
+ /**
629
+ * Body param: `filter` narrows results to runs matching this LangSmith filter
630
+ * expression, evaluated against each individual run. For example: and(eq(run_type,
631
+ * "llm"), gt(latency, 5)) or eq(status, "error"). See
632
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
633
+ * for syntax.
634
+ */
635
+ filter?: string;
636
+ /**
637
+ * Body param: `has_error` filters to runs that errored (true) or completed without
638
+ * error (false).
639
+ */
640
+ has_error?: boolean;
641
+ /**
642
+ * Body param: `ids` optionally limits the request to these run UUIDs.
643
+ */
644
+ ids?: Array<string>;
645
+ /**
646
+ * Body param: `is_root` returns only root runs (true) or only non-root runs
647
+ * (false).
648
+ */
649
+ is_root?: boolean;
650
+ /**
651
+ * Body param: `max_start_time` is the upper bound for run `start_time` (RFC3339).
652
+ * Defaults to now.
653
+ */
654
+ max_start_time?: string;
655
+ /**
656
+ * Body param: `min_start_time` is the lower bound for run `start_time` (RFC3339).
657
+ * Defaults to 1 day ago.
658
+ */
659
+ min_start_time?: string;
660
+ /**
661
+ * Body param: `project_ids` lists tracing project UUIDs to query. Required unless
662
+ * `reference_dataset_id` is set. Mutually exclusive with `reference_dataset_id` —
663
+ * set exactly one of them.
664
+ */
665
+ project_ids?: Array<string>;
666
+ /**
667
+ * Body param: `reference_dataset_id` resolves session IDs server-side from the
668
+ * dataset. Required unless `project_ids` is set. Mutually exclusive with
669
+ * `project_ids` — set exactly one of them. When provided and `min_start_time` is
670
+ * omitted, the server derives it from the earliest session creation date.
671
+ */
672
+ reference_dataset_id?: string;
673
+ /**
674
+ * Body param: `reference_examples` optionally limits to runs linked to these
675
+ * dataset example UUIDs.
676
+ */
677
+ reference_examples?: Array<string>;
678
+ /**
679
+ * Body param: `run_type`, when set, restricts results to runs whose `run_type`
680
+ * equals this value.
681
+ */
682
+ run_type?: RunType;
683
+ /**
684
+ * Body param: `selects` lists which properties to include on each returned run. If
685
+ * omitted, only `id` is returned. Properties not listed are omitted from each run
686
+ * object.
687
+ */
688
+ selects?: Array<RunSelectField>;
689
+ /**
690
+ * Body param: `trace_filter` narrows results to runs whose root trace matches this
691
+ * LangSmith filter expression. Use this to filter by properties of the trace's
692
+ * root run — for example eq(status, "success") to include only traces that
693
+ * completed without error. See
694
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
695
+ * for syntax.
696
+ */
697
+ trace_filter?: string;
698
+ /**
699
+ * Body param: `trace_id` optionally limits results to runs belonging to this trace
700
+ * UUID.
701
+ */
702
+ trace_id?: string;
703
+ /**
704
+ * Body param: `tree_filter` narrows results to runs that belong to a trace
705
+ * containing at least one run matching this LangSmith filter expression anywhere
706
+ * in the run tree (not just the root). Use this to find runs inside traces that
707
+ * involved a specific tool, tag, or model — for example has(tags, "production") or
708
+ * eq(name, "my_tool"). See
709
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
710
+ * for syntax.
711
+ */
712
+ tree_filter?: string;
713
+ /**
714
+ * Header param: application/json
715
+ */
716
+ Accept?: string;
717
+ }
718
+ export interface RunRetrieveV2Params {
719
+ /**
720
+ * Query param: `project_id` is the UUID of the tracing project that owns the run.
721
+ */
722
+ project_id: string;
723
+ /**
724
+ * Query param: `selects` lists which properties to include on the returned run
725
+ * (repeatable query parameter). Accepts any value of the `RunSelectField` enum. If
726
+ * omitted, only `id` is returned.
727
+ */
728
+ 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'>;
729
+ /**
730
+ * Query param: `start_time` is the run's `start_time` (RFC3339 date-time).
731
+ * Providing it speeds up retrieval.
732
+ */
733
+ start_time?: string;
734
+ /**
735
+ * Header param: application/json
736
+ */
737
+ Accept?: string;
738
+ }
739
+ export interface RunRetrieveParams {
740
+ /**
741
+ * Query param: `project_id` is the UUID of the tracing project that owns the run.
742
+ */
743
+ project_id: string;
744
+ /**
745
+ * Query param: `selects` lists which properties to include on the returned run
746
+ * (repeatable query parameter). Accepts any value of the `RunSelectField` enum. If
747
+ * omitted, only `id` is returned.
748
+ */
749
+ 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'>;
750
+ /**
751
+ * Query param: `start_time` is the run's `start_time` (RFC3339 date-time).
752
+ * Providing it speeds up retrieval.
753
+ */
754
+ start_time?: string;
755
+ /**
756
+ * Header param: application/json
757
+ */
758
+ Accept?: string;
759
+ }
760
+ export interface RunQueryParams extends ItemsCursorPostPaginationParams {
761
+ /**
762
+ * Body param: `filter` narrows results to runs matching this LangSmith filter
763
+ * expression, evaluated against each individual run. For example: and(eq(run_type,
764
+ * "llm"), gt(latency, 5)) or eq(status, "error"). See
765
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
766
+ * for syntax.
767
+ */
768
+ filter?: string;
769
+ /**
770
+ * Body param: `has_error` filters to runs that errored (true) or completed without
771
+ * error (false).
772
+ */
773
+ has_error?: boolean;
774
+ /**
775
+ * Body param: `ids` optionally limits the request to these run UUIDs.
776
+ */
777
+ ids?: Array<string>;
778
+ /**
779
+ * Body param: `is_root` returns only root runs (true) or only non-root runs
780
+ * (false).
781
+ */
782
+ is_root?: boolean;
783
+ /**
784
+ * Body param: `max_start_time` is the upper bound for run `start_time` (RFC3339).
785
+ * Defaults to now.
786
+ */
787
+ max_start_time?: string;
788
+ /**
789
+ * Body param: `min_start_time` is the lower bound for run `start_time` (RFC3339).
790
+ * Defaults to 1 day ago.
791
+ */
792
+ min_start_time?: string;
793
+ /**
794
+ * Body param: `project_ids` lists tracing project UUIDs to query. Required unless
795
+ * `reference_dataset_id` is set. Mutually exclusive with `reference_dataset_id` —
796
+ * set exactly one of them.
797
+ */
798
+ project_ids?: Array<string>;
799
+ /**
800
+ * Body param: `reference_dataset_id` resolves session IDs server-side from the
801
+ * dataset. Required unless `project_ids` is set. Mutually exclusive with
802
+ * `project_ids` — set exactly one of them. When provided and `min_start_time` is
803
+ * omitted, the server derives it from the earliest session creation date.
804
+ */
805
+ reference_dataset_id?: string;
806
+ /**
807
+ * Body param: `reference_examples` optionally limits to runs linked to these
808
+ * dataset example UUIDs.
809
+ */
810
+ reference_examples?: Array<string>;
811
+ /**
812
+ * Body param: `run_type`, when set, restricts results to runs whose `run_type`
813
+ * equals this value.
814
+ */
815
+ run_type?: RunType;
816
+ /**
817
+ * Body param: `selects` lists which properties to include on each returned run. If
818
+ * omitted, only `id` is returned. Properties not listed are omitted from each run
819
+ * object.
820
+ */
821
+ selects?: Array<RunSelectField>;
822
+ /**
823
+ * Body param: `trace_filter` narrows results to runs whose root trace matches this
824
+ * LangSmith filter expression. Use this to filter by properties of the trace's
825
+ * root run — for example eq(status, "success") to include only traces that
826
+ * completed without error. See
827
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
828
+ * for syntax.
829
+ */
830
+ trace_filter?: string;
831
+ /**
832
+ * Body param: `trace_id` optionally limits results to runs belonging to this trace
833
+ * UUID.
834
+ */
835
+ trace_id?: string;
836
+ /**
837
+ * Body param: `tree_filter` narrows results to runs that belong to a trace
838
+ * containing at least one run matching this LangSmith filter expression anywhere
839
+ * in the run tree (not just the root). Use this to find runs inside traces that
840
+ * involved a specific tool, tag, or model — for example has(tags, "production") or
841
+ * eq(name, "my_tool"). See
842
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
843
+ * for syntax.
844
+ */
845
+ tree_filter?: string;
846
+ /**
847
+ * Header param: application/json
848
+ */
849
+ Accept?: string;
850
+ }
851
+ export declare namespace Runs {
852
+ export { type ResponseBodyForRunsGenerateQuery as ResponseBodyForRunsGenerateQuery, type Run as Run, type RunIngest as RunIngest, type RunSchema as RunSchema, type RunSelectField as RunSelectField, type RunStatsQueryParams as RunStatsQueryParams, type RunType as RunType, type RunTypeEnum as RunTypeEnum, type RunsFilterDataSourceTypeEnum as RunsFilterDataSourceTypeEnum, type RunGetURLResponse as RunGetURLResponse, type RunsItemsCursorPostPagination as RunsItemsCursorPostPagination, type RunGetURLParams as RunGetURLParams, type RunQueryV2Params as RunQueryV2Params, type RunRetrieveV2Params as RunRetrieveV2Params, type RunRetrieveParams as RunRetrieveParams, type RunQueryParams as RunQueryParams, };
853
+ export { Share as Share, type ShareCreateResponse as ShareCreateResponse, type ShareCreateParams as ShareCreateParams, type ShareDeleteParams as ShareDeleteParams, };
854
+ }