openlayer 0.1.32 → 0.1.34
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/dist/index.js +9 -8
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.OpenAIMonitor = exports.OpenlayerClient = void 0;
|
|
20
|
+
const node_fetch_1 = require("node-fetch");
|
|
20
21
|
const openai_1 = require("openai");
|
|
21
22
|
const uuid_1 = require("uuid");
|
|
22
23
|
const request_1 = require("./utils/request");
|
|
@@ -126,7 +127,7 @@ class OpenlayerClient {
|
|
|
126
127
|
catch (_a) { }
|
|
127
128
|
const createInferencePipelineEndpoint = `/projects/${projectId}/inference-pipelines`;
|
|
128
129
|
const createInferencePipelineQuery = this.resolvedQuery(createInferencePipelineEndpoint, { version: this.version });
|
|
129
|
-
const createInferencePipelineResponse = yield
|
|
130
|
+
const createInferencePipelineResponse = yield (0, node_fetch_1.default)(createInferencePipelineQuery, {
|
|
130
131
|
body: JSON.stringify({
|
|
131
132
|
description: '',
|
|
132
133
|
name,
|
|
@@ -137,7 +138,7 @@ class OpenlayerClient {
|
|
|
137
138
|
},
|
|
138
139
|
method: 'POST',
|
|
139
140
|
});
|
|
140
|
-
const inferencePipeline = yield createInferencePipelineResponse.json();
|
|
141
|
+
const inferencePipeline = (yield createInferencePipelineResponse.json());
|
|
141
142
|
if (!(inferencePipeline === null || inferencePipeline === void 0 ? void 0 : inferencePipeline.id)) {
|
|
142
143
|
throw new Error('Error creating inference pipeline');
|
|
143
144
|
}
|
|
@@ -158,7 +159,7 @@ class OpenlayerClient {
|
|
|
158
159
|
catch (_b) { }
|
|
159
160
|
const projectsEndpoint = '/projects';
|
|
160
161
|
const projectsQuery = this.resolvedQuery(projectsEndpoint);
|
|
161
|
-
const response = yield
|
|
162
|
+
const response = yield (0, node_fetch_1.default)(projectsQuery, {
|
|
162
163
|
body: JSON.stringify({
|
|
163
164
|
description,
|
|
164
165
|
name,
|
|
@@ -170,7 +171,7 @@ class OpenlayerClient {
|
|
|
170
171
|
},
|
|
171
172
|
method: 'POST',
|
|
172
173
|
});
|
|
173
|
-
const data = yield response.json();
|
|
174
|
+
const data = (yield response.json());
|
|
174
175
|
const { items: projects, error } = data;
|
|
175
176
|
if (!Array.isArray(projects)) {
|
|
176
177
|
throw new Error(typeof error === 'string' ? error : 'Invalid response from Openlayer');
|
|
@@ -195,14 +196,14 @@ class OpenlayerClient {
|
|
|
195
196
|
version: this.version,
|
|
196
197
|
};
|
|
197
198
|
const inferencePipelineQuery = this.resolvedQuery(inferencePipelineEndpoint, inferencePipelineQueryParameters);
|
|
198
|
-
const inferencePipelineResponse = yield
|
|
199
|
+
const inferencePipelineResponse = yield (0, node_fetch_1.default)(inferencePipelineQuery, {
|
|
199
200
|
headers: {
|
|
200
201
|
Authorization: `Bearer ${this.openlayerApiKey}`,
|
|
201
202
|
'Content-Type': 'application/json',
|
|
202
203
|
},
|
|
203
204
|
method: 'GET',
|
|
204
205
|
});
|
|
205
|
-
const { items: inferencePipelines, error } = yield inferencePipelineResponse.json();
|
|
206
|
+
const { items: inferencePipelines, error } = (yield inferencePipelineResponse.json());
|
|
206
207
|
const inferencePipeline = Array.isArray(inferencePipelines)
|
|
207
208
|
? inferencePipelines.find((p) => p.name === name)
|
|
208
209
|
: undefined;
|
|
@@ -224,7 +225,7 @@ class OpenlayerClient {
|
|
|
224
225
|
version: this.version,
|
|
225
226
|
};
|
|
226
227
|
const projectsQuery = this.resolvedQuery(projectsEndpoint, projectsQueryParameters);
|
|
227
|
-
const response = yield
|
|
228
|
+
const response = yield (0, node_fetch_1.default)(projectsQuery, {
|
|
228
229
|
headers: {
|
|
229
230
|
Authorization: `Bearer ${this.openlayerApiKey}`,
|
|
230
231
|
'Content-Type': 'application/json',
|
|
@@ -257,7 +258,7 @@ class OpenlayerClient {
|
|
|
257
258
|
try {
|
|
258
259
|
const dataStreamEndpoint = `/inference-pipelines/${inferencePipelineId}/data-stream`;
|
|
259
260
|
const dataStreamQuery = this.resolvedQuery(dataStreamEndpoint);
|
|
260
|
-
const response = yield
|
|
261
|
+
const response = yield (0, node_fetch_1.default)(dataStreamQuery, {
|
|
261
262
|
body: JSON.stringify({
|
|
262
263
|
config,
|
|
263
264
|
rows: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openlayer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"description": "The Openlayer TypeScript client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"eslint-config-prettier": "^9.0.0",
|
|
19
19
|
"eslint-plugin-prettier": "^5.0.1",
|
|
20
20
|
"eslint-plugin-typescript-sort-keys": "^3.1.0",
|
|
21
|
-
"node-fetch": "^
|
|
21
|
+
"node-fetch": "^2.6.1",
|
|
22
22
|
"openai": "^4.19.0",
|
|
23
23
|
"uuid": "^9.0.1"
|
|
24
24
|
},
|