langsmith 0.7.8 → 0.7.10

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 (228) hide show
  1. package/README.md +161 -15
  2. package/dist/_openapi_client/client.cjs +814 -0
  3. package/dist/_openapi_client/client.d.ts +247 -0
  4. package/dist/_openapi_client/client.js +777 -0
  5. package/dist/_openapi_client/core/api-promise.cjs +100 -0
  6. package/dist/_openapi_client/core/api-promise.d.ts +45 -0
  7. package/dist/_openapi_client/core/api-promise.js +96 -0
  8. package/dist/_openapi_client/core/error.cjs +134 -0
  9. package/dist/_openapi_client/core/error.d.ts +45 -0
  10. package/dist/_openapi_client/core/error.js +118 -0
  11. package/dist/_openapi_client/core/pagination.cjs +374 -0
  12. package/dist/_openapi_client/core/pagination.d.ts +157 -0
  13. package/dist/_openapi_client/core/pagination.js +361 -0
  14. package/dist/_openapi_client/core/resource.cjs +17 -0
  15. package/dist/_openapi_client/core/resource.d.ts +5 -0
  16. package/dist/_openapi_client/core/resource.js +13 -0
  17. package/dist/_openapi_client/core/uploads.cjs +5 -0
  18. package/dist/_openapi_client/core/uploads.d.ts +2 -0
  19. package/dist/_openapi_client/core/uploads.js +1 -0
  20. package/dist/_openapi_client/index.cjs +29 -0
  21. package/dist/_openapi_client/index.d.ts +6 -0
  22. package/dist/_openapi_client/index.js +8 -0
  23. package/dist/_openapi_client/internal/builtin-types.cjs +4 -0
  24. package/dist/_openapi_client/internal/builtin-types.d.ts +72 -0
  25. package/dist/_openapi_client/internal/builtin-types.js +3 -0
  26. package/dist/_openapi_client/internal/detect-platform.cjs +162 -0
  27. package/dist/_openapi_client/internal/detect-platform.d.ts +14 -0
  28. package/dist/_openapi_client/internal/detect-platform.js +157 -0
  29. package/dist/_openapi_client/internal/errors.cjs +41 -0
  30. package/dist/_openapi_client/internal/errors.d.ts +2 -0
  31. package/dist/_openapi_client/internal/errors.js +36 -0
  32. package/dist/_openapi_client/internal/headers.cjs +79 -0
  33. package/dist/_openapi_client/internal/headers.d.ts +18 -0
  34. package/dist/_openapi_client/internal/headers.js +74 -0
  35. package/dist/_openapi_client/internal/parse.cjs +40 -0
  36. package/dist/_openapi_client/internal/parse.d.ts +11 -0
  37. package/dist/_openapi_client/internal/parse.js +37 -0
  38. package/dist/_openapi_client/internal/qs/formats.cjs +12 -0
  39. package/dist/_openapi_client/internal/qs/formats.d.ts +6 -0
  40. package/dist/_openapi_client/internal/qs/formats.js +8 -0
  41. package/dist/_openapi_client/internal/qs/stringify.cjs +277 -0
  42. package/dist/_openapi_client/internal/qs/stringify.d.ts +2 -0
  43. package/dist/_openapi_client/internal/qs/stringify.js +274 -0
  44. package/dist/_openapi_client/internal/qs/types.cjs +2 -0
  45. package/dist/_openapi_client/internal/qs/types.d.ts +56 -0
  46. package/dist/_openapi_client/internal/qs/types.js +1 -0
  47. package/dist/_openapi_client/internal/qs/utils.cjs +230 -0
  48. package/dist/_openapi_client/internal/qs/utils.d.ts +14 -0
  49. package/dist/_openapi_client/internal/qs/utils.js +217 -0
  50. package/dist/_openapi_client/internal/request-options.cjs +14 -0
  51. package/dist/_openapi_client/internal/request-options.d.ts +74 -0
  52. package/dist/_openapi_client/internal/request-options.js +10 -0
  53. package/dist/_openapi_client/internal/shim-types.cjs +4 -0
  54. package/dist/_openapi_client/internal/shim-types.d.ts +16 -0
  55. package/dist/_openapi_client/internal/shim-types.js +3 -0
  56. package/dist/_openapi_client/internal/shims.cjs +92 -0
  57. package/dist/_openapi_client/internal/shims.d.ts +25 -0
  58. package/dist/_openapi_client/internal/shims.js +85 -0
  59. package/dist/_openapi_client/internal/to-file.cjs +91 -0
  60. package/dist/_openapi_client/internal/to-file.d.ts +44 -0
  61. package/dist/_openapi_client/internal/to-file.js +88 -0
  62. package/dist/_openapi_client/internal/types.cjs +4 -0
  63. package/dist/_openapi_client/internal/types.d.ts +35 -0
  64. package/dist/_openapi_client/internal/types.js +3 -0
  65. package/dist/_openapi_client/internal/uploads.cjs +140 -0
  66. package/dist/_openapi_client/internal/uploads.d.ts +41 -0
  67. package/dist/_openapi_client/internal/uploads.js +130 -0
  68. package/dist/_openapi_client/internal/utils/env.cjs +22 -0
  69. package/dist/_openapi_client/internal/utils/env.d.ts +8 -0
  70. package/dist/_openapi_client/internal/utils/env.js +18 -0
  71. package/dist/_openapi_client/internal/utils/log.cjs +88 -0
  72. package/dist/_openapi_client/internal/utils/log.d.ts +36 -0
  73. package/dist/_openapi_client/internal/utils/log.js +82 -0
  74. package/dist/_openapi_client/internal/utils/path.cjs +79 -0
  75. package/dist/_openapi_client/internal/utils/path.d.ts +14 -0
  76. package/dist/_openapi_client/internal/utils/path.js +74 -0
  77. package/dist/_openapi_client/internal/utils/query.cjs +42 -0
  78. package/dist/_openapi_client/internal/utils/query.d.ts +1 -0
  79. package/dist/_openapi_client/internal/utils/query.js +6 -0
  80. package/dist/_openapi_client/internal/utils/sleep.cjs +7 -0
  81. package/dist/_openapi_client/internal/utils/sleep.d.ts +1 -0
  82. package/dist/_openapi_client/internal/utils/sleep.js +3 -0
  83. package/dist/_openapi_client/internal/utils/uuid.cjs +19 -0
  84. package/dist/_openapi_client/internal/utils/uuid.d.ts +4 -0
  85. package/dist/_openapi_client/internal/utils/uuid.js +15 -0
  86. package/dist/_openapi_client/internal/utils/values.cjs +112 -0
  87. package/dist/_openapi_client/internal/utils/values.d.ts +17 -0
  88. package/dist/_openapi_client/internal/utils/values.js +94 -0
  89. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.cjs +138 -0
  90. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.d.ts +367 -0
  91. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.js +101 -0
  92. package/dist/_openapi_client/resources/annotation-queues/runs.cjs +46 -0
  93. package/dist/_openapi_client/resources/annotation-queues/runs.d.ts +128 -0
  94. package/dist/_openapi_client/resources/annotation-queues/runs.js +42 -0
  95. package/dist/_openapi_client/resources/commits.cjs +44 -0
  96. package/dist/_openapi_client/resources/commits.d.ts +204 -0
  97. package/dist/_openapi_client/resources/commits.js +40 -0
  98. package/dist/_openapi_client/resources/datasets/comparative.cjs +22 -0
  99. package/dist/_openapi_client/resources/datasets/comparative.d.ts +55 -0
  100. package/dist/_openapi_client/resources/datasets/comparative.js +18 -0
  101. package/dist/_openapi_client/resources/datasets/datasets.cjs +193 -0
  102. package/dist/_openapi_client/resources/datasets/datasets.d.ts +374 -0
  103. package/dist/_openapi_client/resources/datasets/datasets.js +156 -0
  104. package/dist/_openapi_client/resources/datasets/experiments.cjs +16 -0
  105. package/dist/_openapi_client/resources/datasets/experiments.d.ts +23 -0
  106. package/dist/_openapi_client/resources/datasets/experiments.js +12 -0
  107. package/dist/_openapi_client/resources/datasets/group.cjs +17 -0
  108. package/dist/_openapi_client/resources/datasets/group.d.ts +160 -0
  109. package/dist/_openapi_client/resources/datasets/group.js +13 -0
  110. package/dist/_openapi_client/resources/datasets/runs.cjs +29 -0
  111. package/dist/_openapi_client/resources/datasets/runs.d.ts +216 -0
  112. package/dist/_openapi_client/resources/datasets/runs.js +25 -0
  113. package/dist/_openapi_client/resources/datasets/share.cjs +32 -0
  114. package/dist/_openapi_client/resources/datasets/share.d.ts +28 -0
  115. package/dist/_openapi_client/resources/datasets/share.js +28 -0
  116. package/dist/_openapi_client/resources/datasets/splits.cjs +22 -0
  117. package/dist/_openapi_client/resources/datasets/splits.d.ts +30 -0
  118. package/dist/_openapi_client/resources/datasets/splits.js +18 -0
  119. package/dist/_openapi_client/resources/datasets/versions.cjs +23 -0
  120. package/dist/_openapi_client/resources/datasets/versions.d.ts +36 -0
  121. package/dist/_openapi_client/resources/datasets/versions.js +19 -0
  122. package/dist/_openapi_client/resources/evaluators.cjs +15 -0
  123. package/dist/_openapi_client/resources/evaluators.d.ts +125 -0
  124. package/dist/_openapi_client/resources/evaluators.js +11 -0
  125. package/dist/_openapi_client/resources/examples/bulk.cjs +24 -0
  126. package/dist/_openapi_client/resources/examples/bulk.d.ts +78 -0
  127. package/dist/_openapi_client/resources/examples/bulk.js +20 -0
  128. package/dist/_openapi_client/resources/examples/examples.cjs +124 -0
  129. package/dist/_openapi_client/resources/examples/examples.d.ts +182 -0
  130. package/dist/_openapi_client/resources/examples/examples.js +87 -0
  131. package/dist/_openapi_client/resources/examples/validate.cjs +21 -0
  132. package/dist/_openapi_client/resources/examples/validate.d.ts +38 -0
  133. package/dist/_openapi_client/resources/examples/validate.js +17 -0
  134. package/dist/_openapi_client/resources/feedback/configs.cjs +24 -0
  135. package/dist/_openapi_client/resources/feedback/configs.d.ts +18 -0
  136. package/dist/_openapi_client/resources/feedback/configs.js +20 -0
  137. package/dist/_openapi_client/resources/feedback/feedback.cjs +98 -0
  138. package/dist/_openapi_client/resources/feedback/feedback.d.ts +275 -0
  139. package/dist/_openapi_client/resources/feedback/feedback.js +61 -0
  140. package/dist/_openapi_client/resources/feedback/tokens.cjs +35 -0
  141. package/dist/_openapi_client/resources/feedback/tokens.d.ts +130 -0
  142. package/dist/_openapi_client/resources/feedback/tokens.js +31 -0
  143. package/dist/_openapi_client/resources/index.cjs +35 -0
  144. package/dist/_openapi_client/resources/index.d.ts +15 -0
  145. package/dist/_openapi_client/resources/index.js +17 -0
  146. package/dist/_openapi_client/resources/info.cjs +15 -0
  147. package/dist/_openapi_client/resources/info.d.ts +51 -0
  148. package/dist/_openapi_client/resources/info.js +11 -0
  149. package/dist/_openapi_client/resources/online-evaluators.cjs +70 -0
  150. package/dist/_openapi_client/resources/online-evaluators.d.ts +284 -0
  151. package/dist/_openapi_client/resources/online-evaluators.js +66 -0
  152. package/dist/_openapi_client/resources/public/datasets.cjs +47 -0
  153. package/dist/_openapi_client/resources/public/datasets.d.ts +152 -0
  154. package/dist/_openapi_client/resources/public/datasets.js +43 -0
  155. package/dist/_openapi_client/resources/public/public.cjs +62 -0
  156. package/dist/_openapi_client/resources/public/public.d.ts +32 -0
  157. package/dist/_openapi_client/resources/public/public.js +25 -0
  158. package/dist/_openapi_client/resources/repos/directories.cjs +40 -0
  159. package/dist/_openapi_client/resources/repos/directories.d.ts +72 -0
  160. package/dist/_openapi_client/resources/repos/directories.js +36 -0
  161. package/dist/_openapi_client/resources/repos/repos.cjs +93 -0
  162. package/dist/_openapi_client/resources/repos/repos.d.ts +188 -0
  163. package/dist/_openapi_client/resources/repos/repos.js +56 -0
  164. package/dist/_openapi_client/resources/runs/rules.cjs +9 -0
  165. package/dist/_openapi_client/resources/runs/rules.d.ts +3 -0
  166. package/dist/_openapi_client/resources/runs/rules.js +5 -0
  167. package/dist/_openapi_client/resources/runs/runs.cjs +102 -0
  168. package/dist/_openapi_client/resources/runs/runs.d.ts +542 -0
  169. package/dist/_openapi_client/resources/runs/runs.js +65 -0
  170. package/dist/_openapi_client/resources/sandboxes/boxes.cjs +86 -0
  171. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +1121 -0
  172. package/dist/_openapi_client/resources/sandboxes/boxes.js +82 -0
  173. package/dist/_openapi_client/resources/sandboxes/sandboxes.cjs +63 -0
  174. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +13 -0
  175. package/dist/_openapi_client/resources/sandboxes/sandboxes.js +26 -0
  176. package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +39 -0
  177. package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +130 -0
  178. package/dist/_openapi_client/resources/sandboxes/snapshots.js +35 -0
  179. package/dist/_openapi_client/resources/sessions/insights.cjs +54 -0
  180. package/dist/_openapi_client/resources/sessions/insights.d.ts +246 -0
  181. package/dist/_openapi_client/resources/sessions/insights.js +50 -0
  182. package/dist/_openapi_client/resources/sessions/sessions.cjs +109 -0
  183. package/dist/_openapi_client/resources/sessions/sessions.d.ts +674 -0
  184. package/dist/_openapi_client/resources/sessions/sessions.js +72 -0
  185. package/dist/_openapi_client/resources/settings.cjs +15 -0
  186. package/dist/_openapi_client/resources/settings.d.ts +18 -0
  187. package/dist/_openapi_client/resources/settings.js +11 -0
  188. package/dist/_openapi_client/resources/workspaces.cjs +35 -0
  189. package/dist/_openapi_client/resources/workspaces.d.ts +84 -0
  190. package/dist/_openapi_client/resources/workspaces.js +31 -0
  191. package/dist/_openapi_client/version.cjs +5 -0
  192. package/dist/_openapi_client/version.d.ts +1 -0
  193. package/dist/_openapi_client/version.js +2 -0
  194. package/dist/client.cjs +48 -19
  195. package/dist/client.d.ts +5 -0
  196. package/dist/client.js +29 -0
  197. package/dist/env.cjs +3 -3
  198. package/dist/env.d.ts +1 -1
  199. package/dist/env.js +1 -1
  200. package/dist/experimental/otel/exporter.cjs +1 -1
  201. package/dist/experimental/otel/exporter.js +2 -2
  202. package/dist/experimental/vercel/telemetry.cjs +1 -1
  203. package/dist/experimental/vercel/telemetry.js +2 -2
  204. package/dist/index.cjs +4 -2
  205. package/dist/index.d.ts +2 -1
  206. package/dist/index.js +2 -1
  207. package/dist/run_trees.cjs +1 -1
  208. package/dist/run_trees.js +2 -2
  209. package/dist/sandbox/client.cjs +11 -3
  210. package/dist/sandbox/client.js +11 -3
  211. package/dist/sandbox/index.cjs +8 -2
  212. package/dist/sandbox/index.d.ts +3 -2
  213. package/dist/sandbox/index.js +2 -1
  214. package/dist/sandbox/mounts.cjs +114 -0
  215. package/dist/sandbox/mounts.d.ts +24 -0
  216. package/dist/sandbox/mounts.js +109 -0
  217. package/dist/sandbox/proxy_config.cjs +90 -5
  218. package/dist/sandbox/proxy_config.d.ts +19 -4
  219. package/dist/sandbox/proxy_config.js +86 -4
  220. package/dist/sandbox/types.d.ts +92 -3
  221. package/dist/traceable.cjs +1 -1
  222. package/dist/traceable.js +2 -2
  223. package/dist/utils/guard.cjs +13 -0
  224. package/dist/utils/guard.d.ts +6 -0
  225. package/dist/utils/guard.js +10 -0
  226. package/dist/utils/jestlike/globals.cjs +1 -1
  227. package/dist/utils/jestlike/globals.js +2 -2
  228. package/package.json +2 -2
@@ -0,0 +1,19 @@
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 { OffsetPaginationTopLevelArray, } from '../../core/pagination.js';
5
+ import { path } from '../../internal/utils/path.js';
6
+ export class Versions extends APIResource {
7
+ /**
8
+ * Get dataset versions.
9
+ */
10
+ list(datasetID, query = {}, options) {
11
+ return this._client.getAPIList(path `/api/v1/datasets/${datasetID}/versions`, (OffsetPaginationTopLevelArray), { query, ...options });
12
+ }
13
+ /**
14
+ * Get diff between two dataset versions.
15
+ */
16
+ retrieveDiff(datasetID, query, options) {
17
+ return this._client.get(path `/api/v1/datasets/${datasetID}/versions/diff`, { query, ...options });
18
+ }
19
+ }
@@ -0,0 +1,15 @@
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.Evaluators = void 0;
6
+ const resource_js_1 = require("../core/resource.cjs");
7
+ class Evaluators extends resource_js_1.APIResource {
8
+ /**
9
+ * List all run rules.
10
+ */
11
+ list(query = {}, options) {
12
+ return this._client.get('/api/v1/runs/rules', { query, ...options });
13
+ }
14
+ }
15
+ exports.Evaluators = Evaluators;
@@ -0,0 +1,125 @@
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 Evaluators extends APIResource {
5
+ /**
6
+ * List all run rules.
7
+ */
8
+ list(query?: EvaluatorListParams | null | undefined, options?: RequestOptions): APIPromise<EvaluatorListResponse>;
9
+ }
10
+ export interface CodeEvaluatorTopLevel {
11
+ code: string;
12
+ language?: 'python' | 'javascript' | null;
13
+ }
14
+ /**
15
+ * Run rules schema.
16
+ */
17
+ export interface Evaluator {
18
+ id: string;
19
+ created_at: string;
20
+ display_name: string;
21
+ evaluator_version: number;
22
+ sampling_rate: number;
23
+ tenant_id: string;
24
+ updated_at: string;
25
+ webhooks: Array<EvaluatorWebhook> | null;
26
+ add_to_annotation_queue_id?: string | null;
27
+ add_to_annotation_queue_name?: string | null;
28
+ add_to_dataset_id?: string | null;
29
+ add_to_dataset_name?: string | null;
30
+ add_to_dataset_prefer_correction?: boolean;
31
+ alerts?: Array<EvaluatorPagerdutyAlert> | null;
32
+ alignment_annotation_queue_id?: string | null;
33
+ backfill_completed_at?: string | null;
34
+ backfill_error?: string | null;
35
+ backfill_from?: string | null;
36
+ backfill_id?: string | null;
37
+ backfill_progress?: number | null;
38
+ backfill_status?: string | null;
39
+ code_evaluators?: Array<CodeEvaluatorTopLevel> | null;
40
+ corrections_dataset_id?: string | null;
41
+ dataset_id?: string | null;
42
+ dataset_name?: string | null;
43
+ evaluator_id?: string | null;
44
+ evaluators?: Array<EvaluatorTopLevel> | null;
45
+ extend_evaluator_trace_retention?: boolean | null;
46
+ extend_only?: boolean;
47
+ filter?: string | null;
48
+ group_by?: 'thread_id' | null;
49
+ include_extended_stats?: boolean;
50
+ is_enabled?: boolean;
51
+ num_few_shot_examples?: number | null;
52
+ session_id?: string | null;
53
+ session_name?: string | null;
54
+ spend_limit?: Evaluator.SpendLimit | null;
55
+ spend_usd?: number | null;
56
+ trace_count?: number | null;
57
+ trace_filter?: string | null;
58
+ transient?: boolean;
59
+ tree_filter?: string | null;
60
+ use_corrections_dataset?: boolean;
61
+ }
62
+ export declare namespace Evaluator {
63
+ interface SpendLimit {
64
+ limit_usd: string;
65
+ window: 'weekly';
66
+ }
67
+ }
68
+ export interface EvaluatorPagerdutyAlert {
69
+ routing_key: string;
70
+ /**
71
+ * Enum for severity.
72
+ */
73
+ severity?: 'critical' | 'warning' | 'error' | 'info' | null;
74
+ summary?: string | null;
75
+ /**
76
+ * Enum for alert types.
77
+ */
78
+ type?: 'pagerduty' | null;
79
+ }
80
+ export interface EvaluatorTopLevel {
81
+ /**
82
+ * Evaluator structured output schema.
83
+ */
84
+ structured: EvaluatorTopLevel.Structured;
85
+ }
86
+ export declare namespace EvaluatorTopLevel {
87
+ /**
88
+ * Evaluator structured output schema.
89
+ */
90
+ interface Structured {
91
+ hub_ref?: string | null;
92
+ model?: {
93
+ [key: string]: unknown;
94
+ } | null;
95
+ playground_settings_id?: string | null;
96
+ prompt?: Array<Array<unknown>> | null;
97
+ schema?: {
98
+ [key: string]: unknown;
99
+ } | null;
100
+ template_format?: string | null;
101
+ variable_mapping?: {
102
+ [key: string]: string;
103
+ } | null;
104
+ }
105
+ }
106
+ export interface EvaluatorWebhook {
107
+ url: string;
108
+ headers?: {
109
+ [key: string]: string;
110
+ } | null;
111
+ }
112
+ export type EvaluatorListResponse = Array<Evaluator>;
113
+ export interface EvaluatorListParams {
114
+ id?: Array<string> | null;
115
+ dataset_id?: string | null;
116
+ evaluator_id?: string | null;
117
+ include_backfill_progress?: boolean;
118
+ name_contains?: string | null;
119
+ session_id?: string | null;
120
+ tag_value_id?: Array<string> | null;
121
+ type?: 'session' | 'dataset' | null;
122
+ }
123
+ export declare namespace Evaluators {
124
+ export { type CodeEvaluatorTopLevel as CodeEvaluatorTopLevel, type Evaluator as Evaluator, type EvaluatorPagerdutyAlert as EvaluatorPagerdutyAlert, type EvaluatorTopLevel as EvaluatorTopLevel, type EvaluatorWebhook as EvaluatorWebhook, type EvaluatorListResponse as EvaluatorListResponse, type EvaluatorListParams as EvaluatorListParams, };
125
+ }
@@ -0,0 +1,11 @@
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
+ export class Evaluators extends APIResource {
5
+ /**
6
+ * List all run rules.
7
+ */
8
+ list(query = {}, options) {
9
+ return this._client.get('/api/v1/runs/rules', { query, ...options });
10
+ }
11
+ }
@@ -0,0 +1,24 @@
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.Bulk = void 0;
6
+ const resource_js_1 = require("../../core/resource.cjs");
7
+ class Bulk extends resource_js_1.APIResource {
8
+ /**
9
+ * Create bulk examples.
10
+ */
11
+ create(params, options) {
12
+ const { body } = params;
13
+ return this._client.post('/api/v1/examples/bulk', { body: body, ...options });
14
+ }
15
+ /**
16
+ * Legacy update examples in bulk. For update involving attachments, use PATCH
17
+ * /v1/platform/datasets/{dataset_id}/examples instead.
18
+ */
19
+ patchAll(params, options) {
20
+ const { body } = params;
21
+ return this._client.patch('/api/v1/examples/bulk', { body: body, ...options });
22
+ }
23
+ }
24
+ exports.Bulk = Bulk;
@@ -0,0 +1,78 @@
1
+ import { APIResource } from '../../core/resource.js';
2
+ import * as ExamplesAPI from './examples.js';
3
+ import { APIPromise } from '../../core/api-promise.js';
4
+ import { RequestOptions } from '../../internal/request-options.js';
5
+ export declare class Bulk extends APIResource {
6
+ /**
7
+ * Create bulk examples.
8
+ */
9
+ create(params: BulkCreateParams, options?: RequestOptions): APIPromise<BulkCreateResponse>;
10
+ /**
11
+ * Legacy update examples in bulk. For update involving attachments, use PATCH
12
+ * /v1/platform/datasets/{dataset_id}/examples instead.
13
+ */
14
+ patchAll(params: BulkPatchAllParams, options?: RequestOptions): APIPromise<unknown>;
15
+ }
16
+ export type BulkCreateResponse = Array<ExamplesAPI.Example>;
17
+ export type BulkPatchAllResponse = unknown;
18
+ export interface BulkCreateParams {
19
+ /**
20
+ * Schema for a batch of examples to be created.
21
+ */
22
+ body: Array<BulkCreateParams.Body>;
23
+ }
24
+ export declare namespace BulkCreateParams {
25
+ /**
26
+ * Example with optional created_at to prevent duplicate versions in bulk
27
+ * operations.
28
+ */
29
+ interface Body {
30
+ dataset_id: string;
31
+ id?: string | null;
32
+ created_at?: string | null;
33
+ inputs?: {
34
+ [key: string]: unknown;
35
+ } | null;
36
+ metadata?: {
37
+ [key: string]: unknown;
38
+ } | null;
39
+ outputs?: {
40
+ [key: string]: unknown;
41
+ } | null;
42
+ source_run_id?: string | null;
43
+ split?: Array<string> | string | null;
44
+ /**
45
+ * Use Legacy Message Format for LLM runs
46
+ */
47
+ use_legacy_message_format?: boolean;
48
+ use_source_run_attachments?: Array<string>;
49
+ use_source_run_io?: boolean;
50
+ }
51
+ }
52
+ export interface BulkPatchAllParams {
53
+ body: Array<BulkPatchAllParams.Body>;
54
+ }
55
+ export declare namespace BulkPatchAllParams {
56
+ /**
57
+ * Bulk update class for Example (includes example id).
58
+ */
59
+ interface Body {
60
+ id: string;
61
+ attachments_operations?: ExamplesAPI.AttachmentsOperations | null;
62
+ dataset_id?: string | null;
63
+ inputs?: {
64
+ [key: string]: unknown;
65
+ } | null;
66
+ metadata?: {
67
+ [key: string]: unknown;
68
+ } | null;
69
+ outputs?: {
70
+ [key: string]: unknown;
71
+ } | null;
72
+ overwrite?: boolean;
73
+ split?: Array<string> | string | null;
74
+ }
75
+ }
76
+ export declare namespace Bulk {
77
+ export { type BulkCreateResponse as BulkCreateResponse, type BulkPatchAllResponse as BulkPatchAllResponse, type BulkCreateParams as BulkCreateParams, type BulkPatchAllParams as BulkPatchAllParams, };
78
+ }
@@ -0,0 +1,20 @@
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
+ export class Bulk extends APIResource {
5
+ /**
6
+ * Create bulk examples.
7
+ */
8
+ create(params, options) {
9
+ const { body } = params;
10
+ return this._client.post('/api/v1/examples/bulk', { body: body, ...options });
11
+ }
12
+ /**
13
+ * Legacy update examples in bulk. For update involving attachments, use PATCH
14
+ * /v1/platform/datasets/{dataset_id}/examples instead.
15
+ */
16
+ patchAll(params, options) {
17
+ const { body } = params;
18
+ return this._client.patch('/api/v1/examples/bulk', { body: body, ...options });
19
+ }
20
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.Examples = void 0;
39
+ const resource_js_1 = require("../../core/resource.cjs");
40
+ const BulkAPI = __importStar(require("./bulk.cjs"));
41
+ const bulk_js_1 = require("./bulk.cjs");
42
+ const ValidateAPI = __importStar(require("./validate.cjs"));
43
+ const validate_js_1 = require("./validate.cjs");
44
+ const pagination_js_1 = require("../../core/pagination.cjs");
45
+ const uploads_js_1 = require("../../internal/uploads.cjs");
46
+ const path_js_1 = require("../../internal/utils/path.cjs");
47
+ class Examples extends resource_js_1.APIResource {
48
+ constructor() {
49
+ super(...arguments);
50
+ Object.defineProperty(this, "bulk", {
51
+ enumerable: true,
52
+ configurable: true,
53
+ writable: true,
54
+ value: new BulkAPI.Bulk(this._client)
55
+ });
56
+ Object.defineProperty(this, "validate", {
57
+ enumerable: true,
58
+ configurable: true,
59
+ writable: true,
60
+ value: new ValidateAPI.Validate(this._client)
61
+ });
62
+ }
63
+ /**
64
+ * Create a new example.
65
+ */
66
+ create(body, options) {
67
+ return this._client.post('/api/v1/examples', { body, ...options });
68
+ }
69
+ /**
70
+ * Get a specific example.
71
+ */
72
+ retrieve(exampleID, query = {}, options) {
73
+ return this._client.get((0, path_js_1.path) `/api/v1/examples/${exampleID}`, { query, ...options });
74
+ }
75
+ /**
76
+ * Update a specific example.
77
+ */
78
+ update(exampleID, body, options) {
79
+ return this._client.patch((0, path_js_1.path) `/api/v1/examples/${exampleID}`, { body, ...options });
80
+ }
81
+ /**
82
+ * Get all examples by query params
83
+ */
84
+ list(query = {}, options) {
85
+ return this._client.getAPIList('/api/v1/examples', (pagination_js_1.OffsetPaginationTopLevelArray), {
86
+ query,
87
+ ...options,
88
+ });
89
+ }
90
+ /**
91
+ * Soft delete an example. Only deletes the example in the 'latest' version of the
92
+ * dataset.
93
+ */
94
+ delete(exampleID, options) {
95
+ return this._client.delete((0, path_js_1.path) `/api/v1/examples/${exampleID}`, options);
96
+ }
97
+ /**
98
+ * Soft delete examples. Only deletes the examples in the 'latest' version of the
99
+ * dataset.
100
+ */
101
+ deleteAll(params, options) {
102
+ const { example_ids } = params;
103
+ return this._client.delete('/api/v1/examples', { query: { example_ids }, ...options });
104
+ }
105
+ /**
106
+ * Count all examples by query params
107
+ */
108
+ retrieveCount(query = {}, options) {
109
+ return this._client.get('/api/v1/examples/count', { query, ...options });
110
+ }
111
+ /**
112
+ * Upload examples from a CSV file.
113
+ *
114
+ * Note: For non-csv upload, please use the POST
115
+ * /v1/platform/datasets/{dataset_id}/examples endpoint which provides more
116
+ * efficient upload.
117
+ */
118
+ uploadFromCsv(datasetID, body, options) {
119
+ return this._client.post((0, path_js_1.path) `/api/v1/examples/upload/${datasetID}`, (0, uploads_js_1.multipartFormRequestOptions)({ body, ...options }, this._client));
120
+ }
121
+ }
122
+ exports.Examples = Examples;
123
+ Examples.Bulk = bulk_js_1.Bulk;
124
+ Examples.Validate = validate_js_1.Validate;
@@ -0,0 +1,182 @@
1
+ import { APIResource } from '../../core/resource.js';
2
+ import * as BulkAPI from './bulk.js';
3
+ import { Bulk, BulkCreateParams, BulkCreateResponse, BulkPatchAllParams, BulkPatchAllResponse } from './bulk.js';
4
+ import * as ValidateAPI from './validate.js';
5
+ import { ExampleValidationResult, Validate, ValidateBulkResponse } from './validate.js';
6
+ import { APIPromise } from '../../core/api-promise.js';
7
+ import { OffsetPaginationTopLevelArray, type OffsetPaginationTopLevelArrayParams, PagePromise } from '../../core/pagination.js';
8
+ import { type Uploadable } from '../../core/uploads.js';
9
+ import { RequestOptions } from '../../internal/request-options.js';
10
+ export declare class Examples extends APIResource {
11
+ bulk: BulkAPI.Bulk;
12
+ validate: ValidateAPI.Validate;
13
+ /**
14
+ * Create a new example.
15
+ */
16
+ create(body: ExampleCreateParams, options?: RequestOptions): APIPromise<Example>;
17
+ /**
18
+ * Get a specific example.
19
+ */
20
+ retrieve(exampleID: string, query?: ExampleRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<Example>;
21
+ /**
22
+ * Update a specific example.
23
+ */
24
+ update(exampleID: string, body: ExampleUpdateParams, options?: RequestOptions): APIPromise<unknown>;
25
+ /**
26
+ * Get all examples by query params
27
+ */
28
+ list(query?: ExampleListParams | null | undefined, options?: RequestOptions): PagePromise<ExamplesOffsetPaginationTopLevelArray, Example>;
29
+ /**
30
+ * Soft delete an example. Only deletes the example in the 'latest' version of the
31
+ * dataset.
32
+ */
33
+ delete(exampleID: string, options?: RequestOptions): APIPromise<unknown>;
34
+ /**
35
+ * Soft delete examples. Only deletes the examples in the 'latest' version of the
36
+ * dataset.
37
+ */
38
+ deleteAll(params: ExampleDeleteAllParams, options?: RequestOptions): APIPromise<unknown>;
39
+ /**
40
+ * Count all examples by query params
41
+ */
42
+ retrieveCount(query?: ExampleRetrieveCountParams | null | undefined, options?: RequestOptions): APIPromise<ExampleRetrieveCountResponse>;
43
+ /**
44
+ * Upload examples from a CSV file.
45
+ *
46
+ * Note: For non-csv upload, please use the POST
47
+ * /v1/platform/datasets/{dataset_id}/examples endpoint which provides more
48
+ * efficient upload.
49
+ */
50
+ uploadFromCsv(datasetID: string, body: ExampleUploadFromCsvParams, options?: RequestOptions): APIPromise<ExampleUploadFromCsvResponse>;
51
+ }
52
+ export type ExamplesOffsetPaginationTopLevelArray = OffsetPaginationTopLevelArray<Example>;
53
+ export interface AttachmentsOperations {
54
+ /**
55
+ * Mapping of old attachment names to new names
56
+ */
57
+ rename?: {
58
+ [key: string]: string;
59
+ };
60
+ /**
61
+ * List of attachment names to keep
62
+ */
63
+ retain?: Array<string>;
64
+ }
65
+ /**
66
+ * Example schema.
67
+ */
68
+ export interface Example {
69
+ id: string;
70
+ dataset_id: string;
71
+ inputs: {
72
+ [key: string]: unknown;
73
+ };
74
+ name: string;
75
+ attachment_urls?: {
76
+ [key: string]: unknown;
77
+ } | null;
78
+ created_at?: string;
79
+ metadata?: {
80
+ [key: string]: unknown;
81
+ } | null;
82
+ modified_at?: string | null;
83
+ outputs?: {
84
+ [key: string]: unknown;
85
+ } | null;
86
+ source_run_id?: string | null;
87
+ }
88
+ export type ExampleSelect = 'id' | 'created_at' | 'modified_at' | 'name' | 'dataset_id' | 'source_run_id' | 'metadata' | 'inputs' | 'outputs' | 'attachment_urls';
89
+ export type ExampleUpdateResponse = unknown;
90
+ export type ExampleDeleteResponse = unknown;
91
+ export type ExampleDeleteAllResponse = unknown;
92
+ export type ExampleRetrieveCountResponse = number;
93
+ export type ExampleUploadFromCsvResponse = Array<Example>;
94
+ export interface ExampleCreateParams {
95
+ dataset_id: string;
96
+ id?: string | null;
97
+ created_at?: string;
98
+ inputs?: {
99
+ [key: string]: unknown;
100
+ } | null;
101
+ metadata?: {
102
+ [key: string]: unknown;
103
+ } | null;
104
+ outputs?: {
105
+ [key: string]: unknown;
106
+ } | null;
107
+ source_run_id?: string | null;
108
+ split?: Array<string> | string | null;
109
+ /**
110
+ * Use Legacy Message Format for LLM runs
111
+ */
112
+ use_legacy_message_format?: boolean;
113
+ use_source_run_attachments?: Array<string>;
114
+ use_source_run_io?: boolean;
115
+ }
116
+ export interface ExampleRetrieveParams {
117
+ /**
118
+ * Only modifications made on or before this time are included. If None, the latest
119
+ * version of the dataset is used.
120
+ */
121
+ as_of?: (string & {}) | string;
122
+ dataset?: string | null;
123
+ }
124
+ export interface ExampleUpdateParams {
125
+ attachments_operations?: AttachmentsOperations | null;
126
+ dataset_id?: string | null;
127
+ inputs?: {
128
+ [key: string]: unknown;
129
+ } | null;
130
+ metadata?: {
131
+ [key: string]: unknown;
132
+ } | null;
133
+ outputs?: {
134
+ [key: string]: unknown;
135
+ } | null;
136
+ overwrite?: boolean;
137
+ split?: Array<string> | string | null;
138
+ }
139
+ export interface ExampleListParams extends OffsetPaginationTopLevelArrayParams {
140
+ id?: Array<string> | null;
141
+ /**
142
+ * Only modifications made on or before this time are included. If None, the latest
143
+ * version of the dataset is used.
144
+ */
145
+ as_of?: (string & {}) | string;
146
+ dataset?: string | null;
147
+ descending?: boolean | null;
148
+ filter?: string | null;
149
+ full_text_contains?: Array<string> | null;
150
+ metadata?: string | null;
151
+ order?: 'recent' | 'random' | 'recently_created' | 'id';
152
+ random_seed?: number | null;
153
+ select?: Array<ExampleSelect>;
154
+ splits?: Array<string> | null;
155
+ }
156
+ export interface ExampleDeleteAllParams {
157
+ example_ids: Array<string>;
158
+ }
159
+ export interface ExampleRetrieveCountParams {
160
+ id?: Array<string> | null;
161
+ /**
162
+ * Only modifications made on or before this time are included. If None, the latest
163
+ * version of the dataset is used.
164
+ */
165
+ as_of?: (string & {}) | string;
166
+ dataset?: string | null;
167
+ filter?: string | null;
168
+ full_text_contains?: Array<string> | null;
169
+ metadata?: string | null;
170
+ splits?: Array<string> | null;
171
+ }
172
+ export interface ExampleUploadFromCsvParams {
173
+ file: Uploadable;
174
+ input_keys: Array<string>;
175
+ metadata_keys?: Array<string>;
176
+ output_keys?: Array<string>;
177
+ }
178
+ export declare namespace Examples {
179
+ export { type AttachmentsOperations as AttachmentsOperations, type Example as Example, type ExampleSelect as ExampleSelect, type ExampleUpdateResponse as ExampleUpdateResponse, type ExampleDeleteResponse as ExampleDeleteResponse, type ExampleDeleteAllResponse as ExampleDeleteAllResponse, type ExampleRetrieveCountResponse as ExampleRetrieveCountResponse, type ExampleUploadFromCsvResponse as ExampleUploadFromCsvResponse, type ExamplesOffsetPaginationTopLevelArray as ExamplesOffsetPaginationTopLevelArray, type ExampleCreateParams as ExampleCreateParams, type ExampleRetrieveParams as ExampleRetrieveParams, type ExampleUpdateParams as ExampleUpdateParams, type ExampleListParams as ExampleListParams, type ExampleDeleteAllParams as ExampleDeleteAllParams, type ExampleRetrieveCountParams as ExampleRetrieveCountParams, type ExampleUploadFromCsvParams as ExampleUploadFromCsvParams, };
180
+ export { Bulk as Bulk, type BulkCreateResponse as BulkCreateResponse, type BulkPatchAllResponse as BulkPatchAllResponse, type BulkCreateParams as BulkCreateParams, type BulkPatchAllParams as BulkPatchAllParams, };
181
+ export { Validate as Validate, type ExampleValidationResult as ExampleValidationResult, type ValidateBulkResponse as ValidateBulkResponse, };
182
+ }