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,374 @@
1
+ "use strict";
2
+ // @ts-nocheck
3
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
5
+ if (kind === "m") throw new TypeError("Private method is not writable");
6
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
7
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
8
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
9
+ };
10
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
11
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
12
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
13
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
14
+ };
15
+ var _AbstractPage_client;
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ItemsCursorGetPagination = exports.ItemsCursorPostPagination = exports.CursorPagination = exports.OffsetPaginationInsightsClusteringJobs = exports.OffsetPaginationOnlineEvaluators = exports.OffsetPaginationCommits = exports.OffsetPaginationRepos = exports.OffsetPaginationTopLevelArray = exports.PagePromise = exports.AbstractPage = void 0;
18
+ const error_js_1 = require("./error.cjs");
19
+ const parse_js_1 = require("../internal/parse.cjs");
20
+ const api_promise_js_1 = require("./api-promise.cjs");
21
+ const values_js_1 = require("../internal/utils/values.cjs");
22
+ class AbstractPage {
23
+ constructor(client, response, body, options) {
24
+ _AbstractPage_client.set(this, void 0);
25
+ Object.defineProperty(this, "options", {
26
+ enumerable: true,
27
+ configurable: true,
28
+ writable: true,
29
+ value: void 0
30
+ });
31
+ Object.defineProperty(this, "response", {
32
+ enumerable: true,
33
+ configurable: true,
34
+ writable: true,
35
+ value: void 0
36
+ });
37
+ Object.defineProperty(this, "body", {
38
+ enumerable: true,
39
+ configurable: true,
40
+ writable: true,
41
+ value: void 0
42
+ });
43
+ __classPrivateFieldSet(this, _AbstractPage_client, client, "f");
44
+ this.options = options;
45
+ this.response = response;
46
+ this.body = body;
47
+ }
48
+ hasNextPage() {
49
+ const items = this.getPaginatedItems();
50
+ if (!items.length)
51
+ return false;
52
+ return this.nextPageRequestOptions() != null;
53
+ }
54
+ async getNextPage() {
55
+ const nextOptions = this.nextPageRequestOptions();
56
+ if (!nextOptions) {
57
+ throw new error_js_1.LangsmithError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.');
58
+ }
59
+ return await __classPrivateFieldGet(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions);
60
+ }
61
+ async *iterPages() {
62
+ let page = this;
63
+ yield page;
64
+ while (page.hasNextPage()) {
65
+ page = await page.getNextPage();
66
+ yield page;
67
+ }
68
+ }
69
+ async *[(_AbstractPage_client = new WeakMap(), Symbol.asyncIterator)]() {
70
+ for await (const page of this.iterPages()) {
71
+ for (const item of page.getPaginatedItems()) {
72
+ yield item;
73
+ }
74
+ }
75
+ }
76
+ }
77
+ exports.AbstractPage = AbstractPage;
78
+ /**
79
+ * This subclass of Promise will resolve to an instantiated Page once the request completes.
80
+ *
81
+ * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
82
+ *
83
+ * for await (const item of client.items.list()) {
84
+ * console.log(item)
85
+ * }
86
+ */
87
+ class PagePromise extends api_promise_js_1.APIPromise {
88
+ constructor(client, request, Page) {
89
+ super(client, request, async (client, props) => new Page(client, props.response, await (0, parse_js_1.defaultParseResponse)(client, props), props.options));
90
+ }
91
+ /**
92
+ * Allow auto-paginating iteration on an unawaited list call, eg:
93
+ *
94
+ * for await (const item of client.items.list()) {
95
+ * console.log(item)
96
+ * }
97
+ */
98
+ async *[Symbol.asyncIterator]() {
99
+ const page = await this;
100
+ for await (const item of page) {
101
+ yield item;
102
+ }
103
+ }
104
+ }
105
+ exports.PagePromise = PagePromise;
106
+ class OffsetPaginationTopLevelArray extends AbstractPage {
107
+ constructor(client, response, body, options) {
108
+ super(client, response, body, options);
109
+ Object.defineProperty(this, "items", {
110
+ enumerable: true,
111
+ configurable: true,
112
+ writable: true,
113
+ value: void 0
114
+ });
115
+ this.items = body || [];
116
+ }
117
+ getPaginatedItems() {
118
+ return this.items ?? [];
119
+ }
120
+ nextPageRequestOptions() {
121
+ const offset = this.options.query.offset ?? 0;
122
+ const length = this.getPaginatedItems().length;
123
+ const currentCount = offset + length;
124
+ return {
125
+ ...this.options,
126
+ query: {
127
+ ...(0, values_js_1.maybeObj)(this.options.query),
128
+ offset: currentCount,
129
+ },
130
+ };
131
+ }
132
+ }
133
+ exports.OffsetPaginationTopLevelArray = OffsetPaginationTopLevelArray;
134
+ class OffsetPaginationRepos extends AbstractPage {
135
+ constructor(client, response, body, options) {
136
+ super(client, response, body, options);
137
+ Object.defineProperty(this, "repos", {
138
+ enumerable: true,
139
+ configurable: true,
140
+ writable: true,
141
+ value: void 0
142
+ });
143
+ Object.defineProperty(this, "total", {
144
+ enumerable: true,
145
+ configurable: true,
146
+ writable: true,
147
+ value: void 0
148
+ });
149
+ this.repos = body.repos || [];
150
+ this.total = body.total || 0;
151
+ }
152
+ getPaginatedItems() {
153
+ return this.repos ?? [];
154
+ }
155
+ nextPageRequestOptions() {
156
+ const offset = this.options.query.offset ?? 0;
157
+ const length = this.getPaginatedItems().length;
158
+ const currentCount = offset + length;
159
+ return {
160
+ ...this.options,
161
+ query: {
162
+ ...(0, values_js_1.maybeObj)(this.options.query),
163
+ offset: currentCount,
164
+ },
165
+ };
166
+ }
167
+ }
168
+ exports.OffsetPaginationRepos = OffsetPaginationRepos;
169
+ class OffsetPaginationCommits extends AbstractPage {
170
+ constructor(client, response, body, options) {
171
+ super(client, response, body, options);
172
+ Object.defineProperty(this, "commits", {
173
+ enumerable: true,
174
+ configurable: true,
175
+ writable: true,
176
+ value: void 0
177
+ });
178
+ Object.defineProperty(this, "total", {
179
+ enumerable: true,
180
+ configurable: true,
181
+ writable: true,
182
+ value: void 0
183
+ });
184
+ this.commits = body.commits || [];
185
+ this.total = body.total || 0;
186
+ }
187
+ getPaginatedItems() {
188
+ return this.commits ?? [];
189
+ }
190
+ nextPageRequestOptions() {
191
+ const offset = this.options.query.offset ?? 0;
192
+ const length = this.getPaginatedItems().length;
193
+ const currentCount = offset + length;
194
+ return {
195
+ ...this.options,
196
+ query: {
197
+ ...(0, values_js_1.maybeObj)(this.options.query),
198
+ offset: currentCount,
199
+ },
200
+ };
201
+ }
202
+ }
203
+ exports.OffsetPaginationCommits = OffsetPaginationCommits;
204
+ class OffsetPaginationOnlineEvaluators extends AbstractPage {
205
+ constructor(client, response, body, options) {
206
+ super(client, response, body, options);
207
+ Object.defineProperty(this, "evaluators", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: void 0
212
+ });
213
+ Object.defineProperty(this, "total", {
214
+ enumerable: true,
215
+ configurable: true,
216
+ writable: true,
217
+ value: void 0
218
+ });
219
+ this.evaluators = body.evaluators || [];
220
+ this.total = body.total || 0;
221
+ }
222
+ getPaginatedItems() {
223
+ return this.evaluators ?? [];
224
+ }
225
+ nextPageRequestOptions() {
226
+ const offset = this.options.query.offset ?? 0;
227
+ const length = this.getPaginatedItems().length;
228
+ const currentCount = offset + length;
229
+ return {
230
+ ...this.options,
231
+ query: {
232
+ ...(0, values_js_1.maybeObj)(this.options.query),
233
+ offset: currentCount,
234
+ },
235
+ };
236
+ }
237
+ }
238
+ exports.OffsetPaginationOnlineEvaluators = OffsetPaginationOnlineEvaluators;
239
+ class OffsetPaginationInsightsClusteringJobs extends AbstractPage {
240
+ constructor(client, response, body, options) {
241
+ super(client, response, body, options);
242
+ Object.defineProperty(this, "clustering_jobs", {
243
+ enumerable: true,
244
+ configurable: true,
245
+ writable: true,
246
+ value: void 0
247
+ });
248
+ this.clustering_jobs = body.clustering_jobs || [];
249
+ }
250
+ getPaginatedItems() {
251
+ return this.clustering_jobs ?? [];
252
+ }
253
+ nextPageRequestOptions() {
254
+ const offset = this.options.query.offset ?? 0;
255
+ const length = this.getPaginatedItems().length;
256
+ const currentCount = offset + length;
257
+ return {
258
+ ...this.options,
259
+ query: {
260
+ ...(0, values_js_1.maybeObj)(this.options.query),
261
+ offset: currentCount,
262
+ },
263
+ };
264
+ }
265
+ }
266
+ exports.OffsetPaginationInsightsClusteringJobs = OffsetPaginationInsightsClusteringJobs;
267
+ class CursorPagination extends AbstractPage {
268
+ constructor(client, response, body, options) {
269
+ super(client, response, body, options);
270
+ Object.defineProperty(this, "runs", {
271
+ enumerable: true,
272
+ configurable: true,
273
+ writable: true,
274
+ value: void 0
275
+ });
276
+ Object.defineProperty(this, "cursors", {
277
+ enumerable: true,
278
+ configurable: true,
279
+ writable: true,
280
+ value: void 0
281
+ });
282
+ this.runs = body.runs || [];
283
+ this.cursors = body.cursors || {};
284
+ }
285
+ getPaginatedItems() {
286
+ return this.runs ?? [];
287
+ }
288
+ nextPageRequestOptions() {
289
+ const cursor = this.cursors?.next;
290
+ if (!cursor) {
291
+ return null;
292
+ }
293
+ return {
294
+ ...this.options,
295
+ query: {
296
+ ...(0, values_js_1.maybeObj)(this.options.query),
297
+ cursor,
298
+ },
299
+ };
300
+ }
301
+ }
302
+ exports.CursorPagination = CursorPagination;
303
+ class ItemsCursorPostPagination extends AbstractPage {
304
+ constructor(client, response, body, options) {
305
+ super(client, response, body, options);
306
+ Object.defineProperty(this, "items", {
307
+ enumerable: true,
308
+ configurable: true,
309
+ writable: true,
310
+ value: void 0
311
+ });
312
+ Object.defineProperty(this, "next_cursor", {
313
+ enumerable: true,
314
+ configurable: true,
315
+ writable: true,
316
+ value: void 0
317
+ });
318
+ this.items = body.items || [];
319
+ this.next_cursor = body.next_cursor || '';
320
+ }
321
+ getPaginatedItems() {
322
+ return this.items ?? [];
323
+ }
324
+ nextPageRequestOptions() {
325
+ const cursor = this.next_cursor;
326
+ if (!cursor) {
327
+ return null;
328
+ }
329
+ return {
330
+ ...this.options,
331
+ body: {
332
+ ...(0, values_js_1.maybeObj)(this.options.body),
333
+ cursor,
334
+ },
335
+ };
336
+ }
337
+ }
338
+ exports.ItemsCursorPostPagination = ItemsCursorPostPagination;
339
+ class ItemsCursorGetPagination extends AbstractPage {
340
+ constructor(client, response, body, options) {
341
+ super(client, response, body, options);
342
+ Object.defineProperty(this, "items", {
343
+ enumerable: true,
344
+ configurable: true,
345
+ writable: true,
346
+ value: void 0
347
+ });
348
+ Object.defineProperty(this, "next_cursor", {
349
+ enumerable: true,
350
+ configurable: true,
351
+ writable: true,
352
+ value: void 0
353
+ });
354
+ this.items = body.items || [];
355
+ this.next_cursor = body.next_cursor || '';
356
+ }
357
+ getPaginatedItems() {
358
+ return this.items ?? [];
359
+ }
360
+ nextPageRequestOptions() {
361
+ const cursor = this.next_cursor;
362
+ if (!cursor) {
363
+ return null;
364
+ }
365
+ return {
366
+ ...this.options,
367
+ query: {
368
+ ...(0, values_js_1.maybeObj)(this.options.query),
369
+ cursor,
370
+ },
371
+ };
372
+ }
373
+ }
374
+ exports.ItemsCursorGetPagination = ItemsCursorGetPagination;
@@ -0,0 +1,157 @@
1
+ import { FinalRequestOptions } from '../internal/request-options.js';
2
+ import { type Langsmith } from '../client.js';
3
+ import { APIPromise } from './api-promise.js';
4
+ import { type APIResponseProps } from '../internal/parse.js';
5
+ export type PageRequestOptions = Pick<FinalRequestOptions, 'query' | 'headers' | 'body' | 'path' | 'method'>;
6
+ export declare abstract class AbstractPage<Item> implements AsyncIterable<Item> {
7
+ #private;
8
+ protected options: FinalRequestOptions;
9
+ protected response: Response;
10
+ protected body: unknown;
11
+ constructor(client: Langsmith, response: Response, body: unknown, options: FinalRequestOptions);
12
+ abstract nextPageRequestOptions(): PageRequestOptions | null;
13
+ abstract getPaginatedItems(): Item[];
14
+ hasNextPage(): boolean;
15
+ getNextPage(): Promise<this>;
16
+ iterPages(): AsyncGenerator<this>;
17
+ [Symbol.asyncIterator](): AsyncGenerator<Item>;
18
+ }
19
+ /**
20
+ * This subclass of Promise will resolve to an instantiated Page once the request completes.
21
+ *
22
+ * It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
23
+ *
24
+ * for await (const item of client.items.list()) {
25
+ * console.log(item)
26
+ * }
27
+ */
28
+ export declare class PagePromise<PageClass extends AbstractPage<Item>, Item = ReturnType<PageClass['getPaginatedItems']>[number]> extends APIPromise<PageClass> implements AsyncIterable<Item> {
29
+ constructor(client: Langsmith, request: Promise<APIResponseProps>, Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass);
30
+ /**
31
+ * Allow auto-paginating iteration on an unawaited list call, eg:
32
+ *
33
+ * for await (const item of client.items.list()) {
34
+ * console.log(item)
35
+ * }
36
+ */
37
+ [Symbol.asyncIterator](): AsyncGenerator<Item>;
38
+ }
39
+ export type OffsetPaginationTopLevelArrayResponse<Item> = Item[];
40
+ export interface OffsetPaginationTopLevelArrayParams {
41
+ offset?: number;
42
+ limit?: number;
43
+ }
44
+ export declare class OffsetPaginationTopLevelArray<Item> extends AbstractPage<Item> {
45
+ items: Array<Item>;
46
+ constructor(client: Langsmith, response: Response, body: OffsetPaginationTopLevelArrayResponse<Item>, options: FinalRequestOptions);
47
+ getPaginatedItems(): Item[];
48
+ nextPageRequestOptions(): PageRequestOptions | null;
49
+ }
50
+ export interface OffsetPaginationReposResponse<Item> {
51
+ repos: Array<Item>;
52
+ total: number;
53
+ }
54
+ export interface OffsetPaginationReposParams {
55
+ offset?: number;
56
+ limit?: number;
57
+ }
58
+ export declare class OffsetPaginationRepos<Item> extends AbstractPage<Item> implements OffsetPaginationReposResponse<Item> {
59
+ repos: Array<Item>;
60
+ total: number;
61
+ constructor(client: Langsmith, response: Response, body: OffsetPaginationReposResponse<Item>, options: FinalRequestOptions);
62
+ getPaginatedItems(): Item[];
63
+ nextPageRequestOptions(): PageRequestOptions | null;
64
+ }
65
+ export interface OffsetPaginationCommitsResponse<Item> {
66
+ commits: Array<Item>;
67
+ total: number;
68
+ }
69
+ export interface OffsetPaginationCommitsParams {
70
+ offset?: number;
71
+ limit?: number;
72
+ }
73
+ export declare class OffsetPaginationCommits<Item> extends AbstractPage<Item> implements OffsetPaginationCommitsResponse<Item> {
74
+ commits: Array<Item>;
75
+ total: number;
76
+ constructor(client: Langsmith, response: Response, body: OffsetPaginationCommitsResponse<Item>, options: FinalRequestOptions);
77
+ getPaginatedItems(): Item[];
78
+ nextPageRequestOptions(): PageRequestOptions | null;
79
+ }
80
+ export interface OffsetPaginationOnlineEvaluatorsResponse<Item> {
81
+ evaluators: Array<Item>;
82
+ total: number;
83
+ }
84
+ export interface OffsetPaginationOnlineEvaluatorsParams {
85
+ offset?: number;
86
+ limit?: number;
87
+ }
88
+ export declare class OffsetPaginationOnlineEvaluators<Item> extends AbstractPage<Item> implements OffsetPaginationOnlineEvaluatorsResponse<Item> {
89
+ evaluators: Array<Item>;
90
+ total: number;
91
+ constructor(client: Langsmith, response: Response, body: OffsetPaginationOnlineEvaluatorsResponse<Item>, options: FinalRequestOptions);
92
+ getPaginatedItems(): Item[];
93
+ nextPageRequestOptions(): PageRequestOptions | null;
94
+ }
95
+ export interface OffsetPaginationInsightsClusteringJobsResponse<Item> {
96
+ clustering_jobs: Array<Item>;
97
+ }
98
+ export interface OffsetPaginationInsightsClusteringJobsParams {
99
+ offset?: number;
100
+ limit?: number;
101
+ }
102
+ export declare class OffsetPaginationInsightsClusteringJobs<Item> extends AbstractPage<Item> implements OffsetPaginationInsightsClusteringJobsResponse<Item> {
103
+ clustering_jobs: Array<Item>;
104
+ constructor(client: Langsmith, response: Response, body: OffsetPaginationInsightsClusteringJobsResponse<Item>, options: FinalRequestOptions);
105
+ getPaginatedItems(): Item[];
106
+ nextPageRequestOptions(): PageRequestOptions | null;
107
+ }
108
+ export interface CursorPaginationResponse<Item> {
109
+ runs: Array<Item>;
110
+ cursors: CursorPaginationResponse.Cursors;
111
+ }
112
+ export declare namespace CursorPaginationResponse {
113
+ interface Cursors {
114
+ next?: string;
115
+ }
116
+ }
117
+ export interface CursorPaginationParams {
118
+ cursor?: string;
119
+ limit?: number;
120
+ }
121
+ export declare class CursorPagination<Item> extends AbstractPage<Item> implements CursorPaginationResponse<Item> {
122
+ runs: Array<Item>;
123
+ cursors: CursorPaginationResponse.Cursors;
124
+ constructor(client: Langsmith, response: Response, body: CursorPaginationResponse<Item>, options: FinalRequestOptions);
125
+ getPaginatedItems(): Item[];
126
+ nextPageRequestOptions(): PageRequestOptions | null;
127
+ }
128
+ export interface ItemsCursorPostPaginationResponse<Item> {
129
+ items: Array<Item>;
130
+ next_cursor: string;
131
+ }
132
+ export interface ItemsCursorPostPaginationParams {
133
+ cursor?: string;
134
+ page_size?: number;
135
+ }
136
+ export declare class ItemsCursorPostPagination<Item> extends AbstractPage<Item> implements ItemsCursorPostPaginationResponse<Item> {
137
+ items: Array<Item>;
138
+ next_cursor: string;
139
+ constructor(client: Langsmith, response: Response, body: ItemsCursorPostPaginationResponse<Item>, options: FinalRequestOptions);
140
+ getPaginatedItems(): Item[];
141
+ nextPageRequestOptions(): PageRequestOptions | null;
142
+ }
143
+ export interface ItemsCursorGetPaginationResponse<Item> {
144
+ items: Array<Item>;
145
+ next_cursor: string;
146
+ }
147
+ export interface ItemsCursorGetPaginationParams {
148
+ cursor?: string;
149
+ page_size?: number;
150
+ }
151
+ export declare class ItemsCursorGetPagination<Item> extends AbstractPage<Item> implements ItemsCursorGetPaginationResponse<Item> {
152
+ items: Array<Item>;
153
+ next_cursor: string;
154
+ constructor(client: Langsmith, response: Response, body: ItemsCursorGetPaginationResponse<Item>, options: FinalRequestOptions);
155
+ getPaginatedItems(): Item[];
156
+ nextPageRequestOptions(): PageRequestOptions | null;
157
+ }