openlayer 0.4.0 → 0.8.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 +78 -0
- package/README.md +56 -46
- 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 +15 -13
- package/index.d.ts +15 -13
- package/index.d.ts.map +1 -1
- package/index.js +29 -10
- package/index.js.map +1 -1
- package/index.mjs +13 -9
- package/index.mjs.map +1 -1
- package/lib/core/openai-monitor.d.ts +6 -3
- package/lib/core/openai-monitor.d.ts.map +1 -1
- package/lib/core/openai-monitor.js +7 -1
- package/lib/core/openai-monitor.js.map +1 -1
- package/lib/core/openai-monitor.mjs +4 -1
- package/lib/core/openai-monitor.mjs.map +1 -1
- package/lib/integrations/langchainCallback.d.ts +33 -0
- package/lib/integrations/langchainCallback.d.ts.map +1 -0
- package/lib/integrations/langchainCallback.js +114 -0
- package/lib/integrations/langchainCallback.js.map +1 -0
- package/lib/integrations/langchainCallback.mjs +110 -0
- package/lib/integrations/langchainCallback.mjs.map +1 -0
- package/lib/integrations/openAiTracer.d.ts +3 -0
- package/lib/integrations/openAiTracer.d.ts.map +1 -0
- package/lib/integrations/openAiTracer.js +125 -0
- package/lib/integrations/openAiTracer.js.map +1 -0
- package/lib/integrations/openAiTracer.mjs +121 -0
- package/lib/integrations/openAiTracer.mjs.map +1 -0
- package/lib/tracing/enums.d.ts +5 -0
- package/lib/tracing/enums.d.ts.map +1 -0
- package/lib/tracing/enums.js +9 -0
- package/lib/tracing/enums.js.map +1 -0
- package/lib/tracing/enums.mjs +6 -0
- package/lib/tracing/enums.mjs.map +1 -0
- package/lib/tracing/steps.d.ts +57 -0
- package/lib/tracing/steps.d.ts.map +1 -0
- package/lib/tracing/steps.js +84 -0
- package/lib/tracing/steps.js.map +1 -0
- package/lib/tracing/steps.mjs +78 -0
- package/lib/tracing/steps.mjs.map +1 -0
- package/lib/tracing/tracer.d.ts +18 -0
- package/lib/tracing/tracer.d.ts.map +1 -0
- package/lib/tracing/tracer.js +155 -0
- package/lib/tracing/tracer.js.map +1 -0
- package/lib/tracing/tracer.mjs +148 -0
- package/lib/tracing/tracer.mjs.map +1 -0
- package/lib/tracing/traces.d.ts +9 -0
- package/lib/tracing/traces.d.ts.map +1 -0
- package/lib/tracing/traces.js +17 -0
- package/lib/tracing/traces.js.map +1 -0
- package/lib/tracing/traces.mjs +13 -0
- package/lib/tracing/traces.mjs.map +1 -0
- package/package.json +4 -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 +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -1
- package/resources/index.mjs.map +1 -1
- package/resources/inference-pipelines/data.d.ts +2 -4
- package/resources/inference-pipelines/data.d.ts.map +1 -1
- package/resources/inference-pipelines/data.js +1 -3
- package/resources/inference-pipelines/data.js.map +1 -1
- package/resources/inference-pipelines/data.mjs +1 -3
- 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 +1 -1
- package/resources/inference-pipelines/index.mjs.map +1 -1
- package/resources/inference-pipelines/inference-pipelines.d.ts +164 -9
- package/resources/inference-pipelines/inference-pipelines.d.ts.map +1 -1
- package/resources/inference-pipelines/inference-pipelines.js +28 -5
- package/resources/inference-pipelines/inference-pipelines.js.map +1 -1
- package/resources/inference-pipelines/inference-pipelines.mjs +28 -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 +3 -0
- package/resources/storage/index.d.ts.map +1 -0
- package/resources/storage/index.js +9 -0
- package/resources/storage/index.js.map +1 -0
- package/resources/storage/index.mjs +4 -0
- package/resources/storage/index.mjs.map +1 -0
- package/resources/storage/presigned-url.d.ts +32 -0
- package/resources/storage/presigned-url.d.ts.map +1 -0
- package/resources/storage/presigned-url.js +16 -0
- package/resources/storage/presigned-url.js.map +1 -0
- package/resources/storage/presigned-url.mjs +12 -0
- package/resources/storage/presigned-url.mjs.map +1 -0
- package/resources/storage/storage.d.ts +10 -0
- package/resources/storage/storage.d.ts.map +1 -0
- package/resources/storage/storage.js +39 -0
- package/resources/storage/storage.js.map +1 -0
- package/resources/storage/storage.mjs +12 -0
- package/resources/storage/storage.mjs.map +1 -0
- 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 +49 -21
- package/src/lib/core/openai-monitor.ts +10 -4
- package/src/lib/index.d.ts +1 -0
- package/src/lib/integrations/langchainCallback.ts +141 -0
- package/src/lib/integrations/openAiTracer.ts +137 -0
- package/src/lib/tracing/enums.ts +4 -0
- package/src/lib/tracing/index.d.ts +1 -0
- package/src/lib/tracing/steps.ts +118 -0
- package/src/lib/tracing/tracer.ts +204 -0
- package/src/lib/tracing/traces.ts +19 -0
- 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 +11 -5
- package/src/resources/inference-pipelines/data.ts +3 -5
- package/src/resources/inference-pipelines/index.ts +9 -4
- package/src/resources/inference-pipelines/inference-pipelines.ts +254 -10
- 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 +8 -0
- package/src/resources/storage/presigned-url.ts +48 -0
- package/src/resources/storage/storage.ts +19 -0
- 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/lib/.keep +0 -4
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { APIResource } from "../../resource.mjs";
|
|
3
3
|
import { isRequestOptions } from "../../core.mjs";
|
|
4
4
|
import * as CommitsAPI from "./commits.mjs";
|
|
5
|
+
import { Commits, } from "./commits.mjs";
|
|
5
6
|
import * as InferencePipelinesAPI from "./inference-pipelines.mjs";
|
|
7
|
+
import { InferencePipelines, } from "./inference-pipelines.mjs";
|
|
6
8
|
export class Projects extends APIResource {
|
|
7
9
|
constructor() {
|
|
8
10
|
super(...arguments);
|
|
@@ -22,8 +24,6 @@ export class Projects extends APIResource {
|
|
|
22
24
|
return this._client.get('/projects', { query, ...options });
|
|
23
25
|
}
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Projects.InferencePipelines = InferencePipelinesAPI.InferencePipelines;
|
|
28
|
-
})(Projects || (Projects = {}));
|
|
27
|
+
Projects.Commits = Commits;
|
|
28
|
+
Projects.InferencePipelines = InferencePipelines;
|
|
29
29
|
//# sourceMappingURL=projects.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.mjs","sourceRoot":"","sources":["../../src/resources/projects/projects.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;
|
|
1
|
+
{"version":3,"file":"projects.mjs","sourceRoot":"","sources":["../../src/resources/projects/projects.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAEpB,KAAK,UAAU;OACf,EAKL,OAAO,GACR;OACM,KAAK,qBAAqB;OAC1B,EAKL,kBAAkB,GACnB;AAED,MAAM,OAAO,QAAS,SAAQ,WAAW;IAAzC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,uBAAkB,GAA6C,IAAI,qBAAqB,CAAC,kBAAkB,CACzG,IAAI,CAAC,OAAO,CACb,CAAC;IAuBJ,CAAC;IArBC;;OAEG;IACH,MAAM,CAAC,IAAyB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAOD,IAAI,CACF,QAAiD,EAAE,EACnD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF;AAmRD,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,QAAQ,CAAC,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/storage/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EACZ,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,GAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Storage = exports.PresignedURL = void 0;
|
|
5
|
+
var presigned_url_1 = require("./presigned-url.js");
|
|
6
|
+
Object.defineProperty(exports, "PresignedURL", { enumerable: true, get: function () { return presigned_url_1.PresignedURL; } });
|
|
7
|
+
var storage_1 = require("./storage.js");
|
|
8
|
+
Object.defineProperty(exports, "Storage", { enumerable: true, get: function () { return storage_1.Storage; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/storage/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oDAIyB;AAHvB,6GAAA,YAAY,OAAA;AAId,wCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/storage/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,YAAY,GAGb;OACM,EAAE,OAAO,EAAE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { APIResource } from "../../resource.js";
|
|
2
|
+
import * as Core from "../../core.js";
|
|
3
|
+
export declare class PresignedURL extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* Retrieve a presigned url to post storage artifacts.
|
|
6
|
+
*/
|
|
7
|
+
create(params: PresignedURLCreateParams, options?: Core.RequestOptions): Core.APIPromise<PresignedURLCreateResponse>;
|
|
8
|
+
}
|
|
9
|
+
export interface PresignedURLCreateResponse {
|
|
10
|
+
/**
|
|
11
|
+
* The storage URI to send back to the backend after the upload was completed.
|
|
12
|
+
*/
|
|
13
|
+
storageUri: string;
|
|
14
|
+
/**
|
|
15
|
+
* The presigned url.
|
|
16
|
+
*/
|
|
17
|
+
url: string;
|
|
18
|
+
/**
|
|
19
|
+
* Fields to include in the body of the upload. Only needed by s3
|
|
20
|
+
*/
|
|
21
|
+
fields?: unknown;
|
|
22
|
+
}
|
|
23
|
+
export interface PresignedURLCreateParams {
|
|
24
|
+
/**
|
|
25
|
+
* The name of the object.
|
|
26
|
+
*/
|
|
27
|
+
objectName: string;
|
|
28
|
+
}
|
|
29
|
+
export declare namespace PresignedURL {
|
|
30
|
+
export { type PresignedURLCreateResponse as PresignedURLCreateResponse, type PresignedURLCreateParams as PresignedURLCreateParams, };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=presigned-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presigned-url.d.ts","sourceRoot":"","sources":["../../src/resources/storage/presigned-url.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;OAEG;IACH,MAAM,CACJ,MAAM,EAAE,wBAAwB,EAChC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,0BAA0B,CAAC;CAI/C;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PresignedURL = void 0;
|
|
5
|
+
const resource_1 = require("../../resource.js");
|
|
6
|
+
class PresignedURL extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieve a presigned url to post storage artifacts.
|
|
9
|
+
*/
|
|
10
|
+
create(params, options) {
|
|
11
|
+
const { objectName } = params;
|
|
12
|
+
return this._client.post('/storage/presigned-url', { query: { objectName }, ...options });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.PresignedURL = PresignedURL;
|
|
16
|
+
//# sourceMappingURL=presigned-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presigned-url.js","sourceRoot":"","sources":["../../src/resources/storage/presigned-url.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAG7C,MAAa,YAAa,SAAQ,sBAAW;IAC3C;;OAEG;IACH,MAAM,CACJ,MAAgC,EAChC,OAA6B;QAE7B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;CACF;AAXD,oCAWC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../resource.mjs";
|
|
3
|
+
export class PresignedURL extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* Retrieve a presigned url to post storage artifacts.
|
|
6
|
+
*/
|
|
7
|
+
create(params, options) {
|
|
8
|
+
const { objectName } = params;
|
|
9
|
+
return this._client.post('/storage/presigned-url', { query: { objectName }, ...options });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=presigned-url.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"presigned-url.mjs","sourceRoot":"","sources":["../../src/resources/storage/presigned-url.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;OAEG;IACH,MAAM,CACJ,MAAgC,EAChC,OAA6B;QAE7B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAC9B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { APIResource } from "../../resource.js";
|
|
2
|
+
import * as PresignedURLAPI from "./presigned-url.js";
|
|
3
|
+
import { PresignedURL, PresignedURLCreateParams, PresignedURLCreateResponse } from "./presigned-url.js";
|
|
4
|
+
export declare class Storage extends APIResource {
|
|
5
|
+
presignedURL: PresignedURLAPI.PresignedURL;
|
|
6
|
+
}
|
|
7
|
+
export declare namespace Storage {
|
|
8
|
+
export { PresignedURL as PresignedURL, type PresignedURLCreateResponse as PresignedURLCreateResponse, type PresignedURLCreateParams as PresignedURLCreateParams, };
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/resources/storage/storage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,eAAe,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAErG,qBAAa,OAAQ,SAAQ,WAAW;IACtC,YAAY,EAAE,eAAe,CAAC,YAAY,CAAkD;CAC7F;AAID,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.Storage = void 0;
|
|
28
|
+
const resource_1 = require("../../resource.js");
|
|
29
|
+
const PresignedURLAPI = __importStar(require("./presigned-url.js"));
|
|
30
|
+
const presigned_url_1 = require("./presigned-url.js");
|
|
31
|
+
class Storage extends resource_1.APIResource {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.presignedURL = new PresignedURLAPI.PresignedURL(this._client);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.Storage = Storage;
|
|
38
|
+
Storage.PresignedURL = presigned_url_1.PresignedURL;
|
|
39
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/resources/storage/storage.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAEtF,gDAA6C;AAC7C,oEAAmD;AACnD,sDAAqG;AAErG,MAAa,OAAQ,SAAQ,sBAAW;IAAxC;;QACE,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9F,CAAC;CAAA;AAFD,0BAEC;AAED,OAAO,CAAC,YAAY,GAAG,4BAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../resource.mjs";
|
|
3
|
+
import * as PresignedURLAPI from "./presigned-url.mjs";
|
|
4
|
+
import { PresignedURL } from "./presigned-url.mjs";
|
|
5
|
+
export class Storage extends APIResource {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.presignedURL = new PresignedURLAPI.PresignedURL(this._client);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
Storage.PresignedURL = PresignedURL;
|
|
12
|
+
//# sourceMappingURL=storage.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.mjs","sourceRoot":"","sources":["../../src/resources/storage/storage.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,eAAe;OACpB,EAAE,YAAY,EAAwD;AAE7E,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAAxC;;QACE,iBAAY,GAAiC,IAAI,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9F,CAAC;CAAA;AAED,OAAO,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
package/shims/node.d.ts
CHANGED
package/shims/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/shims/node.ts"],"names":[],"mappings":";;;;AACA,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAK9C,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAiB,MAAM,CAAC;QAEtB,KAAY,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEhC,MAAM,QAAQ,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAElC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAEpC,KAAY,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC;QAE5C,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC;QAEpD,KAAY,mBAAmB,GAAG,KAAK,CAAC,mBAAmB,CAAC;QAE5D,MAAM,QAAQ,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAExC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,MAAM,QAAQ,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;QAEhC,KAAY,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAEtC,KAAY,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;QAE9C,MAAM,QAAQ,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC;KACrD;CACF"}
|
|
@@ -13,9 +13,7 @@ import { Readable } from 'node:stream';
|
|
|
13
13
|
import { type RequestOptions } from '../core';
|
|
14
14
|
import { MultipartBody } from './MultipartBody';
|
|
15
15
|
import { type Shims } from './registry';
|
|
16
|
-
|
|
17
|
-
// @ts-ignore (this package does not have proper export maps for this export)
|
|
18
|
-
import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js';
|
|
16
|
+
import { ReadableStream } from 'node:stream/web';
|
|
19
17
|
|
|
20
18
|
type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
|
|
21
19
|
|
|
@@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
|
|
|
7
7
|
export { type Agent } from 'node:http';
|
|
8
8
|
export { type Readable } from 'node:stream';
|
|
9
9
|
export { type ReadStream as FsReadStream } from 'node:fs';
|
|
10
|
-
export { ReadableStream } from 'web
|
|
10
|
+
export { ReadableStream } from 'node:stream/web';
|
|
11
11
|
|
|
12
12
|
export const fetch: typeof nf.default;
|
|
13
13
|
|
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
|
/**
|
|
@@ -116,6 +131,7 @@ export class Openlayer extends Core.APIClient {
|
|
|
116
131
|
projects: API.Projects = new API.Projects(this);
|
|
117
132
|
commits: API.Commits = new API.Commits(this);
|
|
118
133
|
inferencePipelines: API.InferencePipelines = new API.InferencePipelines(this);
|
|
134
|
+
storage: API.Storage = new API.Storage(this);
|
|
119
135
|
|
|
120
136
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
121
137
|
return this._options.defaultQuery;
|
|
@@ -149,6 +165,7 @@ export class Openlayer extends Core.APIClient {
|
|
|
149
165
|
}
|
|
150
166
|
|
|
151
167
|
static Openlayer = this;
|
|
168
|
+
static DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
152
169
|
|
|
153
170
|
static OpenlayerError = Errors.OpenlayerError;
|
|
154
171
|
static APIError = Errors.APIError;
|
|
@@ -168,7 +185,35 @@ export class Openlayer extends Core.APIClient {
|
|
|
168
185
|
static fileFromPath = Uploads.fileFromPath;
|
|
169
186
|
}
|
|
170
187
|
|
|
171
|
-
|
|
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 {
|
|
172
217
|
OpenlayerError,
|
|
173
218
|
APIError,
|
|
174
219
|
APIConnectionError,
|
|
@@ -182,23 +227,6 @@ export const {
|
|
|
182
227
|
InternalServerError,
|
|
183
228
|
PermissionDeniedError,
|
|
184
229
|
UnprocessableEntityError,
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export import toFile = Uploads.toFile;
|
|
188
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
189
|
-
|
|
190
|
-
export namespace Openlayer {
|
|
191
|
-
export import RequestOptions = Core.RequestOptions;
|
|
192
|
-
|
|
193
|
-
export import Projects = API.Projects;
|
|
194
|
-
export import ProjectCreateResponse = API.ProjectCreateResponse;
|
|
195
|
-
export import ProjectListResponse = API.ProjectListResponse;
|
|
196
|
-
export import ProjectCreateParams = API.ProjectCreateParams;
|
|
197
|
-
export import ProjectListParams = API.ProjectListParams;
|
|
198
|
-
|
|
199
|
-
export import Commits = API.Commits;
|
|
200
|
-
|
|
201
|
-
export import InferencePipelines = API.InferencePipelines;
|
|
202
|
-
}
|
|
230
|
+
} from './error';
|
|
203
231
|
|
|
204
232
|
export default Openlayer;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated The module is deprecated. Please use the OpenAI tracer module instead. Refer to https://www.openlayer.com/docs/monitoring/publishing-data#openai for details.
|
|
3
|
+
*/
|
|
1
4
|
import OpenAI from 'openai';
|
|
2
5
|
import { RequestOptions } from 'openai/core';
|
|
3
6
|
import {
|
|
@@ -99,6 +102,9 @@ const OpenAIPricing: { [key: string]: Pricing } = {
|
|
|
99
102
|
},
|
|
100
103
|
};
|
|
101
104
|
|
|
105
|
+
/**
|
|
106
|
+
* @deprecated The OpenAIMonitor is deprecated. Please use the OpenAI tracer module instead. Refer to https://www.openlayer.com/docs/monitoring/publishing-data#openai for details.
|
|
107
|
+
*/
|
|
102
108
|
class OpenAIMonitor {
|
|
103
109
|
private openlayerClient: Openlayer;
|
|
104
110
|
|
|
@@ -147,7 +153,7 @@ class OpenAIMonitor {
|
|
|
147
153
|
content:
|
|
148
154
|
role === 'user' ? `{{ message_${i} }}`
|
|
149
155
|
: content === null || typeof content === 'undefined' ? ''
|
|
150
|
-
: content,
|
|
156
|
+
: String(content),
|
|
151
157
|
role,
|
|
152
158
|
}));
|
|
153
159
|
|
|
@@ -207,7 +213,7 @@ class OpenAIMonitor {
|
|
|
207
213
|
public createChatCompletion = async (
|
|
208
214
|
body: ChatCompletionCreateParams,
|
|
209
215
|
options?: RequestOptions,
|
|
210
|
-
additionalLogs?: Openlayer.RequestOptions
|
|
216
|
+
additionalLogs?: Openlayer.RequestOptions | undefined,
|
|
211
217
|
): Promise<ChatCompletion | Stream<ChatCompletionChunk>> => {
|
|
212
218
|
// Start a timer to measure latency
|
|
213
219
|
const startTime = Date.now();
|
|
@@ -303,7 +309,7 @@ class OpenAIMonitor {
|
|
|
303
309
|
public createCompletion = async (
|
|
304
310
|
body: CompletionCreateParams,
|
|
305
311
|
options?: RequestOptions,
|
|
306
|
-
additionalLogs?: Openlayer.RequestOptions
|
|
312
|
+
additionalLogs?: Openlayer.RequestOptions | undefined,
|
|
307
313
|
): Promise<Completion | Stream<Completion>> => {
|
|
308
314
|
if (!body.prompt) {
|
|
309
315
|
console.error('No prompt provided.');
|
|
@@ -401,7 +407,7 @@ class OpenAIMonitor {
|
|
|
401
407
|
* @param {Openlayer.RequestOptions<any> | undefined} [additionalLogs] - Optional metadata logs to include with the request sent to Openlayer.
|
|
402
408
|
* @returns {Promise<void>} A promise that resolves when the run data has been successfully published to Openlayer.
|
|
403
409
|
*/
|
|
404
|
-
public async monitorThreadRun(run: Run, additionalLogs?: Openlayer.RequestOptions
|
|
410
|
+
public async monitorThreadRun(run: Run, additionalLogs?: Openlayer.RequestOptions | undefined) {
|
|
405
411
|
if (run.status !== 'completed' || this.openlayerInferencePipelineId.length === 0) {
|
|
406
412
|
return;
|
|
407
413
|
}
|
package/src/lib/index.d.ts
CHANGED