openlayer 0.7.0 → 0.9.0
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.
- package/CHANGELOG.md +56 -0
- package/README.md +50 -40
- package/_shims/node-runtime.d.ts.map +1 -1
- package/_shims/node-runtime.js +2 -3
- package/_shims/node-runtime.js.map +1 -1
- package/_shims/node-runtime.mjs +1 -1
- package/_shims/node-runtime.mjs.map +1 -1
- package/_shims/node-types.d.ts +1 -1
- package/core.d.ts +9 -6
- package/core.d.ts.map +1 -1
- package/core.js +31 -9
- package/core.js.map +1 -1
- package/core.mjs +28 -7
- package/core.mjs.map +1 -1
- package/error.d.ts +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +1 -1
- package/error.js.map +1 -1
- package/error.mjs +1 -1
- package/error.mjs.map +1 -1
- package/index.d.mts +14 -17
- package/index.d.ts +14 -17
- package/index.d.ts.map +1 -1
- package/index.js +28 -11
- package/index.js.map +1 -1
- package/index.mjs +12 -10
- package/index.mjs.map +1 -1
- package/lib/core/openai-monitor.d.ts +3 -3
- package/lib/core/openai-monitor.d.ts.map +1 -1
- package/lib/core/openai-monitor.js.map +1 -1
- package/lib/core/openai-monitor.mjs.map +1 -1
- package/lib/tracing/tracer.js +1 -1
- package/lib/tracing/tracer.js.map +1 -1
- package/lib/tracing/tracer.mjs +1 -1
- package/lib/tracing/tracer.mjs.map +1 -1
- package/package.json +3 -3
- package/resources/commits/commits.d.ts +2 -3
- package/resources/commits/commits.d.ts.map +1 -1
- package/resources/commits/commits.js +2 -3
- package/resources/commits/commits.js.map +1 -1
- package/resources/commits/commits.mjs +2 -3
- package/resources/commits/commits.mjs.map +1 -1
- package/resources/commits/index.d.ts +1 -1
- package/resources/commits/index.d.ts.map +1 -1
- package/resources/commits/index.js.map +1 -1
- package/resources/commits/index.mjs.map +1 -1
- package/resources/commits/test-results.d.ts +1 -22
- package/resources/commits/test-results.d.ts.map +1 -1
- package/resources/commits/test-results.js +0 -2
- package/resources/commits/test-results.js.map +1 -1
- package/resources/commits/test-results.mjs +0 -2
- package/resources/commits/test-results.mjs.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/inference-pipelines/data.d.ts +1 -3
- package/resources/inference-pipelines/data.d.ts.map +1 -1
- package/resources/inference-pipelines/data.js +0 -2
- package/resources/inference-pipelines/data.js.map +1 -1
- package/resources/inference-pipelines/data.mjs +0 -2
- package/resources/inference-pipelines/data.mjs.map +1 -1
- package/resources/inference-pipelines/index.d.ts +4 -4
- package/resources/inference-pipelines/index.d.ts.map +1 -1
- package/resources/inference-pipelines/index.js.map +1 -1
- package/resources/inference-pipelines/index.mjs.map +1 -1
- package/resources/inference-pipelines/inference-pipelines.d.ts +7 -13
- package/resources/inference-pipelines/inference-pipelines.d.ts.map +1 -1
- package/resources/inference-pipelines/inference-pipelines.js +6 -5
- package/resources/inference-pipelines/inference-pipelines.js.map +1 -1
- package/resources/inference-pipelines/inference-pipelines.mjs +6 -5
- package/resources/inference-pipelines/inference-pipelines.mjs.map +1 -1
- package/resources/inference-pipelines/rows.d.ts +1 -3
- package/resources/inference-pipelines/rows.d.ts.map +1 -1
- package/resources/inference-pipelines/rows.js +0 -2
- package/resources/inference-pipelines/rows.js.map +1 -1
- package/resources/inference-pipelines/rows.mjs +0 -2
- package/resources/inference-pipelines/rows.mjs.map +1 -1
- package/resources/inference-pipelines/test-results.d.ts +1 -22
- package/resources/inference-pipelines/test-results.d.ts.map +1 -1
- package/resources/inference-pipelines/test-results.js +0 -2
- package/resources/inference-pipelines/test-results.js.map +1 -1
- package/resources/inference-pipelines/test-results.mjs +0 -2
- package/resources/inference-pipelines/test-results.mjs.map +1 -1
- package/resources/projects/commits.d.ts +150 -16
- package/resources/projects/commits.d.ts.map +1 -1
- package/resources/projects/commits.js +6 -2
- package/resources/projects/commits.js.map +1 -1
- package/resources/projects/commits.mjs +6 -2
- package/resources/projects/commits.mjs.map +1 -1
- package/resources/projects/index.d.ts +3 -3
- package/resources/projects/index.d.ts.map +1 -1
- package/resources/projects/index.js.map +1 -1
- package/resources/projects/index.mjs +1 -1
- package/resources/projects/index.mjs.map +1 -1
- package/resources/projects/inference-pipelines.d.ts +1 -24
- package/resources/projects/inference-pipelines.d.ts.map +1 -1
- package/resources/projects/inference-pipelines.js +0 -2
- package/resources/projects/inference-pipelines.js.map +1 -1
- package/resources/projects/inference-pipelines.mjs +0 -2
- package/resources/projects/inference-pipelines.mjs.map +1 -1
- package/resources/projects/projects.d.ts +5 -32
- package/resources/projects/projects.d.ts.map +1 -1
- package/resources/projects/projects.js +4 -4
- package/resources/projects/projects.js.map +1 -1
- package/resources/projects/projects.mjs +4 -4
- package/resources/projects/projects.mjs.map +1 -1
- package/resources/storage/index.d.ts +1 -1
- package/resources/storage/index.d.ts.map +1 -1
- package/resources/storage/index.js.map +1 -1
- package/resources/storage/index.mjs +1 -1
- package/resources/storage/index.mjs.map +1 -1
- package/resources/storage/presigned-url.d.ts +2 -4
- package/resources/storage/presigned-url.d.ts.map +1 -1
- package/resources/storage/presigned-url.js +0 -2
- package/resources/storage/presigned-url.js.map +1 -1
- package/resources/storage/presigned-url.mjs +0 -2
- package/resources/storage/presigned-url.mjs.map +1 -1
- package/resources/storage/storage.d.ts +2 -3
- package/resources/storage/storage.d.ts.map +1 -1
- package/resources/storage/storage.js +2 -3
- package/resources/storage/storage.js.map +1 -1
- package/resources/storage/storage.mjs +2 -3
- package/resources/storage/storage.mjs.map +1 -1
- package/shims/node.d.ts +1 -0
- package/shims/node.d.ts.map +1 -1
- package/src/_shims/node-runtime.ts +1 -3
- package/src/_shims/node-types.d.ts +1 -1
- package/src/core.ts +44 -13
- package/src/error.ts +3 -3
- package/src/index.ts +48 -26
- package/src/lib/core/openai-monitor.ts +3 -3
- package/src/lib/integrations/openAiTracer.ts +1 -1
- package/src/lib/tracing/tracer.ts +1 -1
- package/src/resources/commits/commits.ts +9 -4
- package/src/resources/commits/index.ts +1 -1
- package/src/resources/commits/test-results.ts +5 -28
- package/src/resources/index.ts +7 -7
- package/src/resources/inference-pipelines/data.ts +2 -4
- package/src/resources/inference-pipelines/index.ts +6 -6
- package/src/resources/inference-pipelines/inference-pipelines.ts +31 -14
- package/src/resources/inference-pipelines/rows.ts +2 -4
- package/src/resources/inference-pipelines/test-results.ts +5 -28
- package/src/resources/projects/commits.ts +192 -17
- package/src/resources/projects/index.ts +15 -9
- package/src/resources/projects/inference-pipelines.ts +7 -30
- package/src/resources/projects/projects.ts +40 -38
- package/src/resources/storage/index.ts +5 -1
- package/src/resources/storage/presigned-url.ts +6 -5
- package/src/resources/storage/storage.ts +9 -4
- package/src/uploads.ts +11 -4
- package/src/version.ts +1 -1
- package/uploads.d.ts.map +1 -1
- package/uploads.js +10 -4
- package/uploads.js.map +1 -1
- package/uploads.mjs +10 -4
- package/uploads.mjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/core.ts
CHANGED
|
@@ -84,8 +84,10 @@ export class APIPromise<T> extends Promise<T> {
|
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
_thenUnwrap<U>(transform: (data: T) => U): APIPromise<U> {
|
|
88
|
-
return new APIPromise(this.responsePromise, async (props) =>
|
|
87
|
+
_thenUnwrap<U>(transform: (data: T, props: APIResponseProps) => U): APIPromise<U> {
|
|
88
|
+
return new APIPromise(this.responsePromise, async (props) =>
|
|
89
|
+
transform(await this.parseResponse(props), props),
|
|
90
|
+
);
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
/**
|
|
@@ -274,7 +276,10 @@ export abstract class APIClient {
|
|
|
274
276
|
return null;
|
|
275
277
|
}
|
|
276
278
|
|
|
277
|
-
buildRequest<Req>(
|
|
279
|
+
buildRequest<Req>(
|
|
280
|
+
options: FinalRequestOptions<Req>,
|
|
281
|
+
{ retryCount = 0 }: { retryCount?: number } = {},
|
|
282
|
+
): { req: RequestInit; url: string; timeout: number } {
|
|
278
283
|
const { method, path, query, headers: headers = {} } = options;
|
|
279
284
|
|
|
280
285
|
const body =
|
|
@@ -306,7 +311,7 @@ export abstract class APIClient {
|
|
|
306
311
|
headers[this.idempotencyHeader] = options.idempotencyKey;
|
|
307
312
|
}
|
|
308
313
|
|
|
309
|
-
const reqHeaders = this.buildHeaders({ options, headers, contentLength });
|
|
314
|
+
const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
|
|
310
315
|
|
|
311
316
|
const req: RequestInit = {
|
|
312
317
|
method,
|
|
@@ -325,10 +330,12 @@ export abstract class APIClient {
|
|
|
325
330
|
options,
|
|
326
331
|
headers,
|
|
327
332
|
contentLength,
|
|
333
|
+
retryCount,
|
|
328
334
|
}: {
|
|
329
335
|
options: FinalRequestOptions;
|
|
330
336
|
headers: Record<string, string | null | undefined>;
|
|
331
337
|
contentLength: string | null | undefined;
|
|
338
|
+
retryCount: number;
|
|
332
339
|
}): Record<string, string> {
|
|
333
340
|
const reqHeaders: Record<string, string> = {};
|
|
334
341
|
if (contentLength) {
|
|
@@ -344,6 +351,16 @@ export abstract class APIClient {
|
|
|
344
351
|
delete reqHeaders['content-type'];
|
|
345
352
|
}
|
|
346
353
|
|
|
354
|
+
// Don't set the retry count header if it was already set or removed through default headers or by the
|
|
355
|
+
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
|
|
356
|
+
// account for the removal case.
|
|
357
|
+
if (
|
|
358
|
+
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
|
|
359
|
+
getHeader(headers, 'x-stainless-retry-count') === undefined
|
|
360
|
+
) {
|
|
361
|
+
reqHeaders['x-stainless-retry-count'] = String(retryCount);
|
|
362
|
+
}
|
|
363
|
+
|
|
347
364
|
this.validateHeaders(reqHeaders, headers);
|
|
348
365
|
|
|
349
366
|
return reqHeaders;
|
|
@@ -379,7 +396,7 @@ export abstract class APIClient {
|
|
|
379
396
|
error: Object | undefined,
|
|
380
397
|
message: string | undefined,
|
|
381
398
|
headers: Headers | undefined,
|
|
382
|
-
) {
|
|
399
|
+
): APIError {
|
|
383
400
|
return APIError.generate(status, error, message, headers);
|
|
384
401
|
}
|
|
385
402
|
|
|
@@ -395,13 +412,14 @@ export abstract class APIClient {
|
|
|
395
412
|
retriesRemaining: number | null,
|
|
396
413
|
): Promise<APIResponseProps> {
|
|
397
414
|
const options = await optionsInput;
|
|
415
|
+
const maxRetries = options.maxRetries ?? this.maxRetries;
|
|
398
416
|
if (retriesRemaining == null) {
|
|
399
|
-
retriesRemaining =
|
|
417
|
+
retriesRemaining = maxRetries;
|
|
400
418
|
}
|
|
401
419
|
|
|
402
420
|
await this.prepareOptions(options);
|
|
403
421
|
|
|
404
|
-
const { req, url, timeout } = this.buildRequest(options);
|
|
422
|
+
const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
|
|
405
423
|
|
|
406
424
|
await this.prepareRequest(req, { url, options });
|
|
407
425
|
|
|
@@ -650,9 +668,9 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
650
668
|
return await this.#client.requestAPIList(this.constructor as any, nextOptions);
|
|
651
669
|
}
|
|
652
670
|
|
|
653
|
-
async *iterPages() {
|
|
671
|
+
async *iterPages(): AsyncGenerator<this> {
|
|
654
672
|
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
655
|
-
let page:
|
|
673
|
+
let page: this = this;
|
|
656
674
|
yield page;
|
|
657
675
|
while (page.hasNextPage()) {
|
|
658
676
|
page = await page.getNextPage();
|
|
@@ -660,7 +678,7 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
660
678
|
}
|
|
661
679
|
}
|
|
662
680
|
|
|
663
|
-
async *[Symbol.asyncIterator]() {
|
|
681
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
664
682
|
for await (const page of this.iterPages()) {
|
|
665
683
|
for (const item of page.getPaginatedItems()) {
|
|
666
684
|
yield item;
|
|
@@ -703,7 +721,7 @@ export class PagePromise<
|
|
|
703
721
|
* console.log(item)
|
|
704
722
|
* }
|
|
705
723
|
*/
|
|
706
|
-
async *[Symbol.asyncIterator]() {
|
|
724
|
+
async *[Symbol.asyncIterator](): AsyncGenerator<Item> {
|
|
707
725
|
const page = await this;
|
|
708
726
|
for await (const item of page) {
|
|
709
727
|
yield item;
|
|
@@ -978,6 +996,11 @@ const validatePositiveInteger = (name: string, n: unknown): number => {
|
|
|
978
996
|
|
|
979
997
|
export const castToError = (err: any): Error => {
|
|
980
998
|
if (err instanceof Error) return err;
|
|
999
|
+
if (typeof err === 'object' && err !== null) {
|
|
1000
|
+
try {
|
|
1001
|
+
return new Error(JSON.stringify(err));
|
|
1002
|
+
} catch {}
|
|
1003
|
+
}
|
|
981
1004
|
return new Error(err);
|
|
982
1005
|
};
|
|
983
1006
|
|
|
@@ -1115,7 +1138,15 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => {
|
|
|
1115
1138
|
return typeof headers?.get === 'function';
|
|
1116
1139
|
};
|
|
1117
1140
|
|
|
1118
|
-
export const getRequiredHeader = (headers: HeadersLike, header: string): string => {
|
|
1141
|
+
export const getRequiredHeader = (headers: HeadersLike | Headers, header: string): string => {
|
|
1142
|
+
const foundHeader = getHeader(headers, header);
|
|
1143
|
+
if (foundHeader === undefined) {
|
|
1144
|
+
throw new Error(`Could not find ${header} header`);
|
|
1145
|
+
}
|
|
1146
|
+
return foundHeader;
|
|
1147
|
+
};
|
|
1148
|
+
|
|
1149
|
+
export const getHeader = (headers: HeadersLike | Headers, header: string): string | undefined => {
|
|
1119
1150
|
const lowerCasedHeader = header.toLowerCase();
|
|
1120
1151
|
if (isHeadersProtocol(headers)) {
|
|
1121
1152
|
// to deal with the case where the header looks like Stainless-Event-Id
|
|
@@ -1141,7 +1172,7 @@ export const getRequiredHeader = (headers: HeadersLike, header: string): string
|
|
|
1141
1172
|
}
|
|
1142
1173
|
}
|
|
1143
1174
|
|
|
1144
|
-
|
|
1175
|
+
return undefined;
|
|
1145
1176
|
};
|
|
1146
1177
|
|
|
1147
1178
|
/**
|
package/src/error.ts
CHANGED
|
@@ -47,9 +47,9 @@ export class APIError extends OpenlayerError {
|
|
|
47
47
|
errorResponse: Object | undefined,
|
|
48
48
|
message: string | undefined,
|
|
49
49
|
headers: Headers | undefined,
|
|
50
|
-
) {
|
|
50
|
+
): APIError {
|
|
51
51
|
if (!status) {
|
|
52
|
-
return new APIConnectionError({ cause: castToError(errorResponse) });
|
|
52
|
+
return new APIConnectionError({ message, cause: castToError(errorResponse) });
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
const error = errorResponse as Record<string, any>;
|
|
@@ -101,7 +101,7 @@ export class APIUserAbortError extends APIError {
|
|
|
101
101
|
export class APIConnectionError extends APIError {
|
|
102
102
|
override readonly status: undefined = undefined;
|
|
103
103
|
|
|
104
|
-
constructor({ message, cause }: { message?: string; cause?: Error | undefined }) {
|
|
104
|
+
constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
|
|
105
105
|
super(undefined, undefined, message || 'Connection error.', undefined);
|
|
106
106
|
// in some environments the 'cause' property is already declared
|
|
107
107
|
// @ts-ignore
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import * as Errors from './error';
|
|
4
|
-
import * as Uploads from './uploads';
|
|
5
3
|
import { type Agent } from './_shims/index';
|
|
6
4
|
import * as Core from './core';
|
|
5
|
+
import * as Errors from './error';
|
|
6
|
+
import * as Uploads from './uploads';
|
|
7
7
|
import * as API from './resources/index';
|
|
8
|
+
import { Commits } from './resources/commits/commits';
|
|
9
|
+
import {
|
|
10
|
+
InferencePipelineRetrieveResponse,
|
|
11
|
+
InferencePipelineUpdateParams,
|
|
12
|
+
InferencePipelineUpdateResponse,
|
|
13
|
+
InferencePipelines,
|
|
14
|
+
} from './resources/inference-pipelines/inference-pipelines';
|
|
15
|
+
import {
|
|
16
|
+
ProjectCreateParams,
|
|
17
|
+
ProjectCreateResponse,
|
|
18
|
+
ProjectListParams,
|
|
19
|
+
ProjectListResponse,
|
|
20
|
+
Projects,
|
|
21
|
+
} from './resources/projects/projects';
|
|
22
|
+
import { Storage } from './resources/storage/storage';
|
|
8
23
|
|
|
9
24
|
export interface ClientOptions {
|
|
10
25
|
/**
|
|
@@ -150,6 +165,7 @@ export class Openlayer extends Core.APIClient {
|
|
|
150
165
|
}
|
|
151
166
|
|
|
152
167
|
static Openlayer = this;
|
|
168
|
+
static DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
153
169
|
|
|
154
170
|
static OpenlayerError = Errors.OpenlayerError;
|
|
155
171
|
static APIError = Errors.APIError;
|
|
@@ -169,7 +185,35 @@ export class Openlayer extends Core.APIClient {
|
|
|
169
185
|
static fileFromPath = Uploads.fileFromPath;
|
|
170
186
|
}
|
|
171
187
|
|
|
172
|
-
|
|
188
|
+
Openlayer.Projects = Projects;
|
|
189
|
+
Openlayer.Commits = Commits;
|
|
190
|
+
Openlayer.InferencePipelines = InferencePipelines;
|
|
191
|
+
Openlayer.Storage = Storage;
|
|
192
|
+
export declare namespace Openlayer {
|
|
193
|
+
export type RequestOptions = Core.RequestOptions;
|
|
194
|
+
|
|
195
|
+
export {
|
|
196
|
+
Projects as Projects,
|
|
197
|
+
type ProjectCreateResponse as ProjectCreateResponse,
|
|
198
|
+
type ProjectListResponse as ProjectListResponse,
|
|
199
|
+
type ProjectCreateParams as ProjectCreateParams,
|
|
200
|
+
type ProjectListParams as ProjectListParams,
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export { Commits as Commits };
|
|
204
|
+
|
|
205
|
+
export {
|
|
206
|
+
InferencePipelines as InferencePipelines,
|
|
207
|
+
type InferencePipelineRetrieveResponse as InferencePipelineRetrieveResponse,
|
|
208
|
+
type InferencePipelineUpdateResponse as InferencePipelineUpdateResponse,
|
|
209
|
+
type InferencePipelineUpdateParams as InferencePipelineUpdateParams,
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export { Storage as Storage };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { toFile, fileFromPath } from './uploads';
|
|
216
|
+
export {
|
|
173
217
|
OpenlayerError,
|
|
174
218
|
APIError,
|
|
175
219
|
APIConnectionError,
|
|
@@ -183,28 +227,6 @@ export const {
|
|
|
183
227
|
InternalServerError,
|
|
184
228
|
PermissionDeniedError,
|
|
185
229
|
UnprocessableEntityError,
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export import toFile = Uploads.toFile;
|
|
189
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
190
|
-
|
|
191
|
-
export namespace Openlayer {
|
|
192
|
-
export import RequestOptions = Core.RequestOptions;
|
|
193
|
-
|
|
194
|
-
export import Projects = API.Projects;
|
|
195
|
-
export import ProjectCreateResponse = API.ProjectCreateResponse;
|
|
196
|
-
export import ProjectListResponse = API.ProjectListResponse;
|
|
197
|
-
export import ProjectCreateParams = API.ProjectCreateParams;
|
|
198
|
-
export import ProjectListParams = API.ProjectListParams;
|
|
199
|
-
|
|
200
|
-
export import Commits = API.Commits;
|
|
201
|
-
|
|
202
|
-
export import InferencePipelines = API.InferencePipelines;
|
|
203
|
-
export import InferencePipelineRetrieveResponse = API.InferencePipelineRetrieveResponse;
|
|
204
|
-
export import InferencePipelineUpdateResponse = API.InferencePipelineUpdateResponse;
|
|
205
|
-
export import InferencePipelineUpdateParams = API.InferencePipelineUpdateParams;
|
|
206
|
-
|
|
207
|
-
export import Storage = API.Storage;
|
|
208
|
-
}
|
|
230
|
+
} from './error';
|
|
209
231
|
|
|
210
232
|
export default Openlayer;
|
|
@@ -213,7 +213,7 @@ class OpenAIMonitor {
|
|
|
213
213
|
public createChatCompletion = async (
|
|
214
214
|
body: ChatCompletionCreateParams,
|
|
215
215
|
options?: RequestOptions,
|
|
216
|
-
additionalLogs?: Openlayer.RequestOptions
|
|
216
|
+
additionalLogs?: Openlayer.RequestOptions | undefined,
|
|
217
217
|
): Promise<ChatCompletion | Stream<ChatCompletionChunk>> => {
|
|
218
218
|
// Start a timer to measure latency
|
|
219
219
|
const startTime = Date.now();
|
|
@@ -309,7 +309,7 @@ class OpenAIMonitor {
|
|
|
309
309
|
public createCompletion = async (
|
|
310
310
|
body: CompletionCreateParams,
|
|
311
311
|
options?: RequestOptions,
|
|
312
|
-
additionalLogs?: Openlayer.RequestOptions
|
|
312
|
+
additionalLogs?: Openlayer.RequestOptions | undefined,
|
|
313
313
|
): Promise<Completion | Stream<Completion>> => {
|
|
314
314
|
if (!body.prompt) {
|
|
315
315
|
console.error('No prompt provided.');
|
|
@@ -407,7 +407,7 @@ class OpenAIMonitor {
|
|
|
407
407
|
* @param {Openlayer.RequestOptions<any> | undefined} [additionalLogs] - Optional metadata logs to include with the request sent to Openlayer.
|
|
408
408
|
* @returns {Promise<void>} A promise that resolves when the run data has been successfully published to Openlayer.
|
|
409
409
|
*/
|
|
410
|
-
public async monitorThreadRun(run: Run, additionalLogs?: Openlayer.RequestOptions
|
|
410
|
+
public async monitorThreadRun(run: Run, additionalLogs?: Openlayer.RequestOptions | undefined) {
|
|
411
411
|
if (run.status !== 'completed' || this.openlayerInferencePipelineId.length === 0) {
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
@@ -184,7 +184,7 @@ function postProcessTrace(traceObj: Trace): { traceData: any; inputVariableNames
|
|
|
184
184
|
const processed_steps = traceObj.toJSON();
|
|
185
185
|
|
|
186
186
|
const traceData = {
|
|
187
|
-
inferenceTimestamp: Date.now(),
|
|
187
|
+
inferenceTimestamp: Math.floor(Date.now() / 1000),
|
|
188
188
|
inferenceId: rootStep!.id.toString(),
|
|
189
189
|
output: rootStep!.output,
|
|
190
190
|
groundTruth: rootStep!.groundTruth,
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as TestResultsAPI from './test-results';
|
|
5
|
+
import { TestResultListParams, TestResultListResponse, TestResults } from './test-results';
|
|
5
6
|
|
|
6
7
|
export class Commits extends APIResource {
|
|
7
8
|
testResults: TestResultsAPI.TestResults = new TestResultsAPI.TestResults(this._client);
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export
|
|
11
|
+
Commits.TestResults = TestResults;
|
|
12
|
+
|
|
13
|
+
export declare namespace Commits {
|
|
14
|
+
export {
|
|
15
|
+
TestResults as TestResults,
|
|
16
|
+
type TestResultListResponse as TestResultListResponse,
|
|
17
|
+
type TestResultListParams as TestResultListParams,
|
|
18
|
+
};
|
|
14
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export { Commits } from './commits';
|
|
4
|
-
export { TestResultListResponse, TestResultListParams
|
|
4
|
+
export { TestResults, type TestResultListResponse, type TestResultListParams } from './test-results';
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import { isRequestOptions } from '../../core';
|
|
5
5
|
import * as Core from '../../core';
|
|
6
|
-
import * as TestResultsAPI from './test-results';
|
|
7
6
|
|
|
8
7
|
export class TestResults extends APIResource {
|
|
9
8
|
/**
|
|
@@ -28,34 +27,10 @@ export class TestResults extends APIResource {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export interface TestResultListResponse {
|
|
31
|
-
_meta: TestResultListResponse._Meta;
|
|
32
|
-
|
|
33
30
|
items: Array<TestResultListResponse.Item>;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
export namespace TestResultListResponse {
|
|
37
|
-
export interface _Meta {
|
|
38
|
-
/**
|
|
39
|
-
* The current page.
|
|
40
|
-
*/
|
|
41
|
-
page: number;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The number of items per page.
|
|
45
|
-
*/
|
|
46
|
-
perPage: number;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The total number of items.
|
|
50
|
-
*/
|
|
51
|
-
totalItems: number;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The total number of pages.
|
|
55
|
-
*/
|
|
56
|
-
totalPages: number;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
34
|
export interface Item {
|
|
60
35
|
/**
|
|
61
36
|
* Project version (commit) id.
|
|
@@ -278,7 +253,9 @@ export interface TestResultListParams {
|
|
|
278
253
|
type?: 'integrity' | 'consistency' | 'performance' | 'fairness' | 'robustness';
|
|
279
254
|
}
|
|
280
255
|
|
|
281
|
-
export namespace TestResults {
|
|
282
|
-
export
|
|
283
|
-
|
|
256
|
+
export declare namespace TestResults {
|
|
257
|
+
export {
|
|
258
|
+
type TestResultListResponse as TestResultListResponse,
|
|
259
|
+
type TestResultListParams as TestResultListParams,
|
|
260
|
+
};
|
|
284
261
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
export { Commits } from './commits/commits';
|
|
4
4
|
export {
|
|
5
|
-
InferencePipelineRetrieveResponse,
|
|
6
|
-
InferencePipelineUpdateResponse,
|
|
7
|
-
InferencePipelineUpdateParams,
|
|
8
5
|
InferencePipelines,
|
|
6
|
+
type InferencePipelineRetrieveResponse,
|
|
7
|
+
type InferencePipelineUpdateResponse,
|
|
8
|
+
type InferencePipelineUpdateParams,
|
|
9
9
|
} from './inference-pipelines/inference-pipelines';
|
|
10
10
|
export {
|
|
11
|
-
ProjectCreateResponse,
|
|
12
|
-
ProjectListResponse,
|
|
13
|
-
ProjectCreateParams,
|
|
14
|
-
ProjectListParams,
|
|
15
11
|
Projects,
|
|
12
|
+
type ProjectCreateResponse,
|
|
13
|
+
type ProjectListResponse,
|
|
14
|
+
type ProjectCreateParams,
|
|
15
|
+
type ProjectListParams,
|
|
16
16
|
} from './projects/projects';
|
|
17
17
|
export { Storage } from './storage/storage';
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as Core from '../../core';
|
|
5
|
-
import * as DataAPI from './data';
|
|
6
5
|
|
|
7
6
|
export class Data extends APIResource {
|
|
8
7
|
/**
|
|
@@ -279,7 +278,6 @@ export namespace DataStreamParams {
|
|
|
279
278
|
}
|
|
280
279
|
}
|
|
281
280
|
|
|
282
|
-
export namespace Data {
|
|
283
|
-
export
|
|
284
|
-
export import DataStreamParams = DataAPI.DataStreamParams;
|
|
281
|
+
export declare namespace Data {
|
|
282
|
+
export { type DataStreamResponse as DataStreamResponse, type DataStreamParams as DataStreamParams };
|
|
285
283
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export { DataStreamResponse, DataStreamParams
|
|
3
|
+
export { Data, type DataStreamResponse, type DataStreamParams } from './data';
|
|
4
4
|
export {
|
|
5
|
-
InferencePipelineRetrieveResponse,
|
|
6
|
-
InferencePipelineUpdateResponse,
|
|
7
|
-
InferencePipelineUpdateParams,
|
|
8
5
|
InferencePipelines,
|
|
6
|
+
type InferencePipelineRetrieveResponse,
|
|
7
|
+
type InferencePipelineUpdateResponse,
|
|
8
|
+
type InferencePipelineUpdateParams,
|
|
9
9
|
} from './inference-pipelines';
|
|
10
|
-
export { RowUpdateResponse, RowUpdateParams
|
|
11
|
-
export { TestResultListResponse, TestResultListParams
|
|
10
|
+
export { Rows, type RowUpdateResponse, type RowUpdateParams } from './rows';
|
|
11
|
+
export { TestResults, type TestResultListResponse, type TestResultListParams } from './test-results';
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import { isRequestOptions } from '../../core';
|
|
5
5
|
import * as Core from '../../core';
|
|
6
|
-
import * as InferencePipelinesAPI from './inference-pipelines';
|
|
7
6
|
import * as DataAPI from './data';
|
|
7
|
+
import { Data, DataStreamParams, DataStreamResponse } from './data';
|
|
8
8
|
import * as RowsAPI from './rows';
|
|
9
|
+
import { RowUpdateParams, RowUpdateResponse, Rows } from './rows';
|
|
9
10
|
import * as TestResultsAPI from './test-results';
|
|
11
|
+
import { TestResultListParams, TestResultListResponse, TestResults } from './test-results';
|
|
10
12
|
|
|
11
13
|
export class InferencePipelines extends APIResource {
|
|
12
14
|
data: DataAPI.Data = new DataAPI.Data(this._client);
|
|
@@ -235,17 +237,32 @@ export interface InferencePipelineUpdateParams {
|
|
|
235
237
|
referenceDatasetUri?: string | null;
|
|
236
238
|
}
|
|
237
239
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
export
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
export
|
|
250
|
-
|
|
240
|
+
InferencePipelines.Data = Data;
|
|
241
|
+
InferencePipelines.Rows = Rows;
|
|
242
|
+
InferencePipelines.TestResults = TestResults;
|
|
243
|
+
|
|
244
|
+
export declare namespace InferencePipelines {
|
|
245
|
+
export {
|
|
246
|
+
type InferencePipelineRetrieveResponse as InferencePipelineRetrieveResponse,
|
|
247
|
+
type InferencePipelineUpdateResponse as InferencePipelineUpdateResponse,
|
|
248
|
+
type InferencePipelineUpdateParams as InferencePipelineUpdateParams,
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export {
|
|
252
|
+
Data as Data,
|
|
253
|
+
type DataStreamResponse as DataStreamResponse,
|
|
254
|
+
type DataStreamParams as DataStreamParams,
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export {
|
|
258
|
+
Rows as Rows,
|
|
259
|
+
type RowUpdateResponse as RowUpdateResponse,
|
|
260
|
+
type RowUpdateParams as RowUpdateParams,
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
export {
|
|
264
|
+
TestResults as TestResults,
|
|
265
|
+
type TestResultListResponse as TestResultListResponse,
|
|
266
|
+
type TestResultListParams as TestResultListParams,
|
|
267
|
+
};
|
|
251
268
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as Core from '../../core';
|
|
5
|
-
import * as RowsAPI from './rows';
|
|
6
5
|
|
|
7
6
|
export class Rows extends APIResource {
|
|
8
7
|
/**
|
|
@@ -75,7 +74,6 @@ export namespace RowUpdateParams {
|
|
|
75
74
|
}
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
export namespace Rows {
|
|
79
|
-
export
|
|
80
|
-
export import RowUpdateParams = RowsAPI.RowUpdateParams;
|
|
77
|
+
export declare namespace Rows {
|
|
78
|
+
export { type RowUpdateResponse as RowUpdateResponse, type RowUpdateParams as RowUpdateParams };
|
|
81
79
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import { isRequestOptions } from '../../core';
|
|
5
5
|
import * as Core from '../../core';
|
|
6
|
-
import * as TestResultsAPI from './test-results';
|
|
7
6
|
|
|
8
7
|
export class TestResults extends APIResource {
|
|
9
8
|
/**
|
|
@@ -28,34 +27,10 @@ export class TestResults extends APIResource {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export interface TestResultListResponse {
|
|
31
|
-
_meta: TestResultListResponse._Meta;
|
|
32
|
-
|
|
33
30
|
items: Array<TestResultListResponse.Item>;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
export namespace TestResultListResponse {
|
|
37
|
-
export interface _Meta {
|
|
38
|
-
/**
|
|
39
|
-
* The current page.
|
|
40
|
-
*/
|
|
41
|
-
page: number;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The number of items per page.
|
|
45
|
-
*/
|
|
46
|
-
perPage: number;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The total number of items.
|
|
50
|
-
*/
|
|
51
|
-
totalItems: number;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* The total number of pages.
|
|
55
|
-
*/
|
|
56
|
-
totalPages: number;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
34
|
export interface Item {
|
|
60
35
|
/**
|
|
61
36
|
* Project version (commit) id.
|
|
@@ -273,7 +248,9 @@ export interface TestResultListParams {
|
|
|
273
248
|
type?: 'integrity' | 'consistency' | 'performance' | 'fairness' | 'robustness';
|
|
274
249
|
}
|
|
275
250
|
|
|
276
|
-
export namespace TestResults {
|
|
277
|
-
export
|
|
278
|
-
|
|
251
|
+
export declare namespace TestResults {
|
|
252
|
+
export {
|
|
253
|
+
type TestResultListResponse as TestResultListResponse,
|
|
254
|
+
type TestResultListParams as TestResultListParams,
|
|
255
|
+
};
|
|
279
256
|
}
|