langsmith 0.7.16 → 0.7.17

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.
@@ -0,0 +1,654 @@
1
+ import { APIResource } from '../core/resource.js';
2
+ import { APIPromise } from '../core/api-promise.js';
3
+ import { ItemsCursorGetPagination, type ItemsCursorGetPaginationParams, ItemsCursorPostPagination, type ItemsCursorPostPaginationParams, PagePromise } from '../core/pagination.js';
4
+ import { RequestOptions } from '../internal/request-options.js';
5
+ export declare class Threads extends APIResource {
6
+ /**
7
+ * **Alpha:** The request and response contract may change; Retrieve all traces
8
+ * belonging to a specific thread within a project.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * // Automatically fetches more pages as needed.
13
+ * for await (const threadTraceListItem of client.threads.listTraces(
14
+ * 'thread_id',
15
+ * { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
16
+ * )) {
17
+ * // ...
18
+ * }
19
+ * ```
20
+ */
21
+ listTraces(threadID: string, query: ThreadListTracesParams, options?: RequestOptions): PagePromise<ThreadTraceListItemsItemsCursorGetPagination, ThreadTraceListItem>;
22
+ /**
23
+ * **Alpha:** The request and response contract may change; Query threads within a
24
+ * project (session), with cursor-based pagination. Returns threads matching the
25
+ * given time range and optional filter.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * // Automatically fetches more pages as needed.
30
+ * for await (const threadListItem of client.threads.query()) {
31
+ * // ...
32
+ * }
33
+ * ```
34
+ */
35
+ query(body: ThreadQueryParams, options?: RequestOptions): PagePromise<ThreadListItemsItemsCursorPostPagination, ThreadListItem>;
36
+ /**
37
+ * **Alpha:** The request and response contract may change; Compute aggregate stats
38
+ * for a single thread (turn count, latency percentiles, token/cost sums, and
39
+ * detail breakdowns) within a project.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const response = await client.threads.stats('thread_id', {
44
+ * selects: ['TURNS'],
45
+ * session_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
46
+ * });
47
+ * ```
48
+ */
49
+ stats(threadID: string, query: ThreadStatsParams, options?: RequestOptions): APIPromise<ThreadStatsResponse>;
50
+ }
51
+ export type ThreadTraceListItemsItemsCursorGetPagination = ItemsCursorGetPagination<ThreadTraceListItem>;
52
+ export type ThreadListItemsItemsCursorPostPagination = ItemsCursorPostPagination<ThreadListItem>;
53
+ export interface ThreadListItem {
54
+ /**
55
+ * `count` is how many root traces (conversation turns) fall in this thread for the
56
+ * query time range.
57
+ */
58
+ count?: number;
59
+ /**
60
+ * `feedback_stats` is the aggregated feedback across traces in the thread, keyed
61
+ * by feedback key; shape matches `feedback_stats` on a single run.
62
+ */
63
+ feedback_stats?: {
64
+ [key: string]: ThreadListItem.FeedbackStats;
65
+ };
66
+ /**
67
+ * `first_inputs` is a truncated preview of inputs from the earliest trace in the
68
+ * thread for the query window.
69
+ */
70
+ first_inputs?: string;
71
+ /**
72
+ * `first_trace_id` is the root trace UUID for the chronologically first trace in
73
+ * the query time window.
74
+ */
75
+ first_trace_id?: string;
76
+ /**
77
+ * `last_error` is a short error summary from the most recent failing trace in the
78
+ * thread. Absent when there is no error in the window.
79
+ */
80
+ last_error?: string;
81
+ /**
82
+ * `last_outputs` is a truncated preview of outputs from the latest trace in the
83
+ * thread for the query window.
84
+ */
85
+ last_outputs?: string;
86
+ /**
87
+ * `last_trace_id` is the root trace UUID for the chronologically last trace in the
88
+ * query time window.
89
+ */
90
+ last_trace_id?: string;
91
+ /**
92
+ * `latency_p50` is the approximate median end-to-end latency of traces in the
93
+ * thread, in seconds.
94
+ */
95
+ latency_p50?: number;
96
+ /**
97
+ * `latency_p99` is the approximate 99th percentile end-to-end latency of traces in
98
+ * the thread, in seconds.
99
+ */
100
+ latency_p99?: number;
101
+ /**
102
+ * `max_start_time` is the latest trace start time in the thread (RFC3339
103
+ * date-time).
104
+ */
105
+ max_start_time?: string;
106
+ /**
107
+ * `min_start_time` is the earliest trace start time in the thread (RFC3339
108
+ * date-time).
109
+ */
110
+ min_start_time?: string;
111
+ /**
112
+ * `num_errored_turns` is the count of root traces in the thread (within the query
113
+ * window) whose status was an error.
114
+ */
115
+ num_errored_turns?: number;
116
+ /**
117
+ * `start_time` is a reference start time for this row (RFC3339 date-time), such as
118
+ * for sorting.
119
+ */
120
+ start_time?: string;
121
+ /**
122
+ * `thread_id` identifies this conversation thread within the project from the
123
+ * request body `project_id`.
124
+ */
125
+ thread_id?: string;
126
+ /**
127
+ * `total_cost` is the sum of estimated USD cost across those traces.
128
+ */
129
+ total_cost?: number;
130
+ /**
131
+ * `total_cost_details` sums per-category estimated USD cost across traces in the
132
+ * thread. Keys mirror `total_token_details`.
133
+ *
134
+ * Example: `{"cache_read": 0.012, "reasoning": 0.008}`.
135
+ */
136
+ total_cost_details?: {
137
+ [key: string]: number;
138
+ };
139
+ /**
140
+ * `total_token_details` sums per-category token counts across traces in the
141
+ * thread. Keys are model-specific category names (for example `cache_read`,
142
+ * `cache_write`, `reasoning`, `audio`).
143
+ *
144
+ * Example: `{"cache_read": 400, "reasoning": 120}`.
145
+ */
146
+ total_token_details?: {
147
+ [key: string]: number;
148
+ };
149
+ /**
150
+ * `total_tokens` is the sum of token usage across those traces.
151
+ */
152
+ total_tokens?: number;
153
+ /**
154
+ * `trace_id` is a representative root trace UUID when the summary includes one,
155
+ * for example for deep links.
156
+ */
157
+ trace_id?: string;
158
+ }
159
+ export declare namespace ThreadListItem {
160
+ interface FeedbackStats {
161
+ /**
162
+ * `avg` is the arithmetic mean of numeric feedback scores for this key on the run,
163
+ * or `null` when no numeric score has been recorded (for example purely
164
+ * categorical feedback).
165
+ */
166
+ avg?: number;
167
+ /**
168
+ * `comments` is a sample of human-readable comments attached to feedback points
169
+ * for this key, in no particular order. May be empty; is not exhaustive when many
170
+ * comments exist.
171
+ */
172
+ comments?: Array<string>;
173
+ /**
174
+ * `contains_thread_feedback` is true when at least one feedback point for this key
175
+ * was submitted at the thread level (rather than at an individual run). Always
176
+ * false on responses that already describe a single run in isolation.
177
+ */
178
+ contains_thread_feedback?: boolean;
179
+ /**
180
+ * `errors` is the number of feedback points recorded as errors rather than
181
+ * successful scores (for example an automated evaluator that raised an exception).
182
+ * Defaults to 0 when no errors occurred.
183
+ */
184
+ errors?: number;
185
+ /**
186
+ * `max` is the largest numeric feedback score recorded for this key on the run, or
187
+ * `null` when no numeric score has been recorded.
188
+ */
189
+ max?: number;
190
+ /**
191
+ * `min` is the smallest numeric feedback score recorded for this key on the run,
192
+ * or `null` when no numeric score has been recorded.
193
+ */
194
+ min?: number;
195
+ /**
196
+ * `n` is the number of feedback points recorded for this key on the run. For
197
+ * numeric feedback this is the sample size behind `avg`, `min`, `max`, and
198
+ * `stdev`; for categorical feedback it is the sum of the `values` counts.
199
+ */
200
+ n?: number;
201
+ /**
202
+ * `sources` is a sample of feedback sources for this key. Each entry is either a
203
+ * plain string identifier (for example `"api"`, `"app"`, `"model"`) or a JSON
204
+ * object describing a synthetic source (for example
205
+ * `{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
206
+ * tolerate both shapes.
207
+ */
208
+ sources?: Array<unknown>;
209
+ /**
210
+ * `stdev` is the sample standard deviation of numeric feedback scores for this key
211
+ * on the run, or `null` when it cannot be computed (for example fewer than two
212
+ * numeric scores, or purely categorical feedback).
213
+ */
214
+ stdev?: number;
215
+ /**
216
+ * `values` is the distribution of categorical feedback labels for this key,
217
+ * mapping each label to its occurrence count. Empty (`{}`) for purely numeric
218
+ * feedback.
219
+ */
220
+ values?: {
221
+ [key: string]: number;
222
+ };
223
+ }
224
+ }
225
+ export interface ThreadTraceListItem {
226
+ /**
227
+ * `completion_cost` is the estimated USD cost for the completion. Omitted unless
228
+ * included in `selects`.
229
+ */
230
+ completion_cost?: number;
231
+ /**
232
+ * `completion_cost_details` is the USD cost breakdown for completion-side
233
+ * categories; per-category values are under `raw`. Omitted unless included in
234
+ * `selects`.
235
+ */
236
+ completion_cost_details?: ThreadTraceListItem.CompletionCostDetails;
237
+ /**
238
+ * `completion_token_details` is the completion-side token breakdown by category;
239
+ * per-category counts are under `raw`. Omitted unless included in `selects`.
240
+ */
241
+ completion_token_details?: ThreadTraceListItem.CompletionTokenDetails;
242
+ /**
243
+ * `completion_tokens` is the completion-side token count. Omitted unless included
244
+ * in `selects`.
245
+ */
246
+ completion_tokens?: number;
247
+ /**
248
+ * `end_time` is when the root run ended (RFC3339 date-time). JSON null if the run
249
+ * is still in progress. Omitted unless included in `selects`.
250
+ */
251
+ end_time?: string;
252
+ /**
253
+ * `error_preview` is a short error summary when the run failed. Omitted unless
254
+ * included in `selects`.
255
+ */
256
+ error_preview?: string;
257
+ /**
258
+ * `first_token_time` is when the first output token was produced (RFC3339
259
+ * date-time), for streamed runs when that metadata exists. Omitted unless included
260
+ * in `selects`.
261
+ */
262
+ first_token_time?: string;
263
+ /**
264
+ * `inputs_preview` is a truncated text preview of inputs. Omitted unless included
265
+ * in `selects`.
266
+ */
267
+ inputs_preview?: string;
268
+ /**
269
+ * `latency` is wall-clock duration from start to end in seconds. Omitted unless
270
+ * included in `selects`.
271
+ */
272
+ latency?: number;
273
+ /**
274
+ * `name` is a human-readable label for the root run (for example the model name,
275
+ * function name, or step name chosen when the run was traced). Omitted unless
276
+ * included in `selects`.
277
+ */
278
+ name?: string;
279
+ /**
280
+ * `op` is a numeric code identifying the root run's `run_type` (for example LLM
281
+ * vs. tool vs. chain). Encoded as a number for compatibility with legacy clients;
282
+ * prefer the string `run_type` on `RunResponse` when available. Omitted unless
283
+ * included in `selects`.
284
+ */
285
+ op?: number;
286
+ /**
287
+ * `outputs_preview` is a truncated text preview of outputs. Omitted unless
288
+ * included in `selects`.
289
+ */
290
+ outputs_preview?: string;
291
+ /**
292
+ * `prompt_cost` is the estimated USD cost for the prompt. Omitted unless included
293
+ * in `selects`.
294
+ */
295
+ prompt_cost?: number;
296
+ /**
297
+ * `prompt_cost_details` is the USD cost breakdown for prompt-side categories;
298
+ * per-category values are under `raw`. Omitted unless included in `selects`.
299
+ */
300
+ prompt_cost_details?: ThreadTraceListItem.PromptCostDetails;
301
+ /**
302
+ * `prompt_token_details` is the prompt-side token breakdown by category;
303
+ * per-category counts are under nested `raw`. Omitted unless included in
304
+ * `selects`.
305
+ */
306
+ prompt_token_details?: ThreadTraceListItem.PromptTokenDetails;
307
+ /**
308
+ * `prompt_tokens` is the prompt-side token count. Omitted unless included in
309
+ * `selects`.
310
+ */
311
+ prompt_tokens?: number;
312
+ /**
313
+ * `start_time` is when the trace started (RFC3339 date-time). Omitted unless
314
+ * included in `selects`.
315
+ */
316
+ start_time?: string;
317
+ /**
318
+ * `thread_id` is the conversation thread UUID that contains this trace. Matches
319
+ * the `thread_id` path parameter of the request. Omitted unless included in
320
+ * `selects`.
321
+ */
322
+ thread_id?: string;
323
+ /**
324
+ * `total_cost` is the estimated total USD cost for the root run. Omitted unless
325
+ * included in `selects`.
326
+ */
327
+ total_cost?: number;
328
+ /**
329
+ * `total_tokens` is the total token count (prompt plus completion). Omitted unless
330
+ * included in `selects`.
331
+ */
332
+ total_tokens?: number;
333
+ /**
334
+ * `trace_id` is the UUID of this trace (the root run). Always present.
335
+ */
336
+ trace_id?: string;
337
+ }
338
+ export declare namespace ThreadTraceListItem {
339
+ /**
340
+ * `completion_cost_details` is the USD cost breakdown for completion-side
341
+ * categories; per-category values are under `raw`. Omitted unless included in
342
+ * `selects`.
343
+ */
344
+ interface CompletionCostDetails {
345
+ /**
346
+ * `raw` maps each category name to its estimated USD cost.
347
+ */
348
+ raw?: {
349
+ [key: string]: number;
350
+ };
351
+ }
352
+ /**
353
+ * `completion_token_details` is the completion-side token breakdown by category;
354
+ * per-category counts are under `raw`. Omitted unless included in `selects`.
355
+ */
356
+ interface CompletionTokenDetails {
357
+ /**
358
+ * `raw` maps each category name to its completion-token count.
359
+ */
360
+ raw?: {
361
+ [key: string]: number;
362
+ };
363
+ }
364
+ /**
365
+ * `prompt_cost_details` is the USD cost breakdown for prompt-side categories;
366
+ * per-category values are under `raw`. Omitted unless included in `selects`.
367
+ */
368
+ interface PromptCostDetails {
369
+ /**
370
+ * `raw` maps each category name to its estimated USD cost.
371
+ */
372
+ raw?: {
373
+ [key: string]: number;
374
+ };
375
+ }
376
+ /**
377
+ * `prompt_token_details` is the prompt-side token breakdown by category;
378
+ * per-category counts are under nested `raw`. Omitted unless included in
379
+ * `selects`.
380
+ */
381
+ interface PromptTokenDetails {
382
+ /**
383
+ * `raw` maps each category name to its prompt-token count.
384
+ */
385
+ raw?: {
386
+ [key: string]: number;
387
+ };
388
+ }
389
+ }
390
+ export interface ThreadStatsResponse {
391
+ /**
392
+ * `completion_cost` is the sum of per-trace completion costs across the thread, in
393
+ * USD. Populated when `COMPLETION_COST` is selected.
394
+ */
395
+ completion_cost?: number;
396
+ /**
397
+ * `completion_cost_details` is the per-sub-category sum of completion cost details
398
+ * across the thread. Populated when `COMPLETION_COST_DETAILS` is selected.
399
+ */
400
+ completion_cost_details?: ThreadStatsResponse.CompletionCostDetails;
401
+ /**
402
+ * `completion_token_details` is the per-sub-category sum of completion token
403
+ * details across the thread. Populated when `COMPLETION_TOKEN_DETAILS` is
404
+ * selected.
405
+ */
406
+ completion_token_details?: ThreadStatsResponse.CompletionTokenDetails;
407
+ /**
408
+ * `completion_tokens` is the sum of per-trace completion token counts across the
409
+ * thread. Populated when `COMPLETION_TOKENS` is selected.
410
+ */
411
+ completion_tokens?: number;
412
+ /**
413
+ * `feedback_stats` aggregates run-level feedback across the thread's traces, keyed
414
+ * by feedback key. Populated when `FEEDBACK_STATS` is selected.
415
+ */
416
+ feedback_stats?: {
417
+ [key: string]: ThreadStatsResponse.FeedbackStats;
418
+ };
419
+ /**
420
+ * `first_start_time` is the earliest trace start time in the thread (RFC3339).
421
+ * Populated when `FIRST_START_TIME` is selected.
422
+ */
423
+ first_start_time?: string;
424
+ /**
425
+ * `last_end_time` is the latest trace end time in the thread (RFC3339). Populated
426
+ * when `LAST_END_TIME` is selected.
427
+ */
428
+ last_end_time?: string;
429
+ /**
430
+ * `last_start_time` is the latest trace start time in the thread (RFC3339).
431
+ * Populated when `LAST_START_TIME` is selected.
432
+ */
433
+ last_start_time?: string;
434
+ /**
435
+ * `latency_p50_seconds` is the approximate p50 of trace latency across the thread,
436
+ * in seconds. Populated when `LATENCY_P50` is selected.
437
+ */
438
+ latency_p50_seconds?: number;
439
+ /**
440
+ * `latency_p99_seconds` is the approximate p99 of trace latency across the thread,
441
+ * in seconds. Populated when `LATENCY_P99` is selected.
442
+ */
443
+ latency_p99_seconds?: number;
444
+ /**
445
+ * `prompt_cost` is the sum of per-trace prompt costs across the thread, in USD.
446
+ * Populated when `PROMPT_COST` is selected.
447
+ */
448
+ prompt_cost?: number;
449
+ /**
450
+ * `prompt_cost_details` is the per-sub-category sum of prompt cost details across
451
+ * the thread. Populated when `PROMPT_COST_DETAILS` is selected.
452
+ */
453
+ prompt_cost_details?: ThreadStatsResponse.PromptCostDetails;
454
+ /**
455
+ * `prompt_token_details` is the per-sub-category sum of prompt token details
456
+ * across the thread. Populated when `PROMPT_TOKEN_DETAILS` is selected.
457
+ */
458
+ prompt_token_details?: ThreadStatsResponse.PromptTokenDetails;
459
+ /**
460
+ * `prompt_tokens` is the sum of per-trace prompt token counts across the thread.
461
+ * Populated when `PROMPT_TOKENS` is selected.
462
+ */
463
+ prompt_tokens?: number;
464
+ /**
465
+ * `total_cost` is the sum of per-trace total costs across the thread, in USD.
466
+ * Populated when `TOTAL_COST` is selected.
467
+ */
468
+ total_cost?: number;
469
+ /**
470
+ * `total_tokens` is the sum of per-trace total token counts across the thread.
471
+ * Populated when `TOTAL_TOKENS` is selected.
472
+ */
473
+ total_tokens?: number;
474
+ /**
475
+ * `turns` is the number of distinct traces (turns) in the thread. Populated when
476
+ * `TURNS` is selected.
477
+ */
478
+ turns?: number;
479
+ }
480
+ export declare namespace ThreadStatsResponse {
481
+ /**
482
+ * `completion_cost_details` is the per-sub-category sum of completion cost details
483
+ * across the thread. Populated when `COMPLETION_COST_DETAILS` is selected.
484
+ */
485
+ interface CompletionCostDetails {
486
+ /**
487
+ * `raw` maps each category name to its estimated USD cost.
488
+ */
489
+ raw?: {
490
+ [key: string]: number;
491
+ };
492
+ }
493
+ /**
494
+ * `completion_token_details` is the per-sub-category sum of completion token
495
+ * details across the thread. Populated when `COMPLETION_TOKEN_DETAILS` is
496
+ * selected.
497
+ */
498
+ interface CompletionTokenDetails {
499
+ /**
500
+ * `raw` maps each category name to its completion-token count.
501
+ */
502
+ raw?: {
503
+ [key: string]: number;
504
+ };
505
+ }
506
+ interface FeedbackStats {
507
+ /**
508
+ * `avg` is the arithmetic mean of numeric feedback scores for this key on the run,
509
+ * or `null` when no numeric score has been recorded (for example purely
510
+ * categorical feedback).
511
+ */
512
+ avg?: number;
513
+ /**
514
+ * `comments` is a sample of human-readable comments attached to feedback points
515
+ * for this key, in no particular order. May be empty; is not exhaustive when many
516
+ * comments exist.
517
+ */
518
+ comments?: Array<string>;
519
+ /**
520
+ * `contains_thread_feedback` is true when at least one feedback point for this key
521
+ * was submitted at the thread level (rather than at an individual run). Always
522
+ * false on responses that already describe a single run in isolation.
523
+ */
524
+ contains_thread_feedback?: boolean;
525
+ /**
526
+ * `errors` is the number of feedback points recorded as errors rather than
527
+ * successful scores (for example an automated evaluator that raised an exception).
528
+ * Defaults to 0 when no errors occurred.
529
+ */
530
+ errors?: number;
531
+ /**
532
+ * `max` is the largest numeric feedback score recorded for this key on the run, or
533
+ * `null` when no numeric score has been recorded.
534
+ */
535
+ max?: number;
536
+ /**
537
+ * `min` is the smallest numeric feedback score recorded for this key on the run,
538
+ * or `null` when no numeric score has been recorded.
539
+ */
540
+ min?: number;
541
+ /**
542
+ * `n` is the number of feedback points recorded for this key on the run. For
543
+ * numeric feedback this is the sample size behind `avg`, `min`, `max`, and
544
+ * `stdev`; for categorical feedback it is the sum of the `values` counts.
545
+ */
546
+ n?: number;
547
+ /**
548
+ * `sources` is a sample of feedback sources for this key. Each entry is either a
549
+ * plain string identifier (for example `"api"`, `"app"`, `"model"`) or a JSON
550
+ * object describing a synthetic source (for example
551
+ * `{"type": "__ls_composite_feedback"}` for a computed aggregate). Clients must
552
+ * tolerate both shapes.
553
+ */
554
+ sources?: Array<unknown>;
555
+ /**
556
+ * `stdev` is the sample standard deviation of numeric feedback scores for this key
557
+ * on the run, or `null` when it cannot be computed (for example fewer than two
558
+ * numeric scores, or purely categorical feedback).
559
+ */
560
+ stdev?: number;
561
+ /**
562
+ * `values` is the distribution of categorical feedback labels for this key,
563
+ * mapping each label to its occurrence count. Empty (`{}`) for purely numeric
564
+ * feedback.
565
+ */
566
+ values?: {
567
+ [key: string]: number;
568
+ };
569
+ }
570
+ /**
571
+ * `prompt_cost_details` is the per-sub-category sum of prompt cost details across
572
+ * the thread. Populated when `PROMPT_COST_DETAILS` is selected.
573
+ */
574
+ interface PromptCostDetails {
575
+ /**
576
+ * `raw` maps each category name to its estimated USD cost.
577
+ */
578
+ raw?: {
579
+ [key: string]: number;
580
+ };
581
+ }
582
+ /**
583
+ * `prompt_token_details` is the per-sub-category sum of prompt token details
584
+ * across the thread. Populated when `PROMPT_TOKEN_DETAILS` is selected.
585
+ */
586
+ interface PromptTokenDetails {
587
+ /**
588
+ * `raw` maps each category name to its prompt-token count.
589
+ */
590
+ raw?: {
591
+ [key: string]: number;
592
+ };
593
+ }
594
+ }
595
+ export interface ThreadListTracesParams extends ItemsCursorGetPaginationParams {
596
+ /**
597
+ * `project_id` is the tracing project UUID (required).
598
+ */
599
+ project_id: string;
600
+ /**
601
+ * `filter` narrows which traces are returned for this thread, using a LangSmith
602
+ * filter expression evaluated against each root trace run. For example: eq(status,
603
+ * "success") or has(tags, "production"). See
604
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
605
+ * for syntax.
606
+ */
607
+ filter?: string;
608
+ /**
609
+ * `selects` lists which properties to include on each returned trace (repeatable
610
+ * query parameter). Accepts any value of the `ThreadTraceSelectField` enum.
611
+ * Properties not listed are omitted from each trace object; `trace_id` is always
612
+ * returned.
613
+ */
614
+ 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'>;
615
+ }
616
+ export interface ThreadQueryParams extends ItemsCursorPostPaginationParams {
617
+ /**
618
+ * `filter` narrows which threads are returned, using a LangSmith filter expression
619
+ * evaluated against each thread's root run. For example: has(tags, "production")
620
+ * or eq(status, "error"). See
621
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
622
+ * for syntax.
623
+ */
624
+ filter?: string;
625
+ /**
626
+ * `max_start_time` is the exclusive upper bound on thread activity (RFC3339
627
+ * date-time).
628
+ */
629
+ max_start_time?: string;
630
+ /**
631
+ * `min_start_time` is the inclusive lower bound on thread activity (RFC3339
632
+ * date-time).
633
+ */
634
+ min_start_time?: string;
635
+ /**
636
+ * `project_id` is the tracing project UUID.
637
+ */
638
+ project_id?: string;
639
+ }
640
+ export interface ThreadStatsParams {
641
+ /**
642
+ * `selects` lists which aggregate stats to compute and return (repeatable query
643
+ * parameter). At least one value is required. Accepts any value of
644
+ * `SingleThreadStatsSelectField`.
645
+ */
646
+ selects: Array<'TURNS' | 'FIRST_START_TIME' | 'LAST_START_TIME' | 'LAST_END_TIME' | 'LATENCY_P50' | 'LATENCY_P99' | 'PROMPT_TOKENS' | 'PROMPT_COST' | 'COMPLETION_TOKENS' | 'COMPLETION_COST' | 'TOTAL_TOKENS' | 'TOTAL_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'FEEDBACK_STATS'>;
647
+ /**
648
+ * `session_id` is the tracing project (session) UUID (required).
649
+ */
650
+ session_id: string;
651
+ }
652
+ export declare namespace Threads {
653
+ export { type ThreadListItem as ThreadListItem, type ThreadTraceListItem as ThreadTraceListItem, type ThreadStatsResponse as ThreadStatsResponse, type ThreadTraceListItemsItemsCursorGetPagination as ThreadTraceListItemsItemsCursorGetPagination, type ThreadListItemsItemsCursorPostPagination as ThreadListItemsItemsCursorPostPagination, type ThreadListTracesParams as ThreadListTracesParams, type ThreadQueryParams as ThreadQueryParams, type ThreadStatsParams as ThreadStatsParams, };
654
+ }