openlayer 0.0.5 → 0.0.7

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 (2) hide show
  1. package/dist/index.js +10 -7
  2. package/package.json +4 -2
package/dist/index.js CHANGED
@@ -16,8 +16,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
16
16
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- const node_fetch_1 = require("node-fetch");
20
19
  const openai_1 = require("openai");
20
+ const uuid_1 = require("uuid");
21
21
  const request_1 = require("./utils/request");
22
22
  class OpenAIMonitor {
23
23
  constructor({ openAiApiKey, openlayerApiKey, openlayerInferencePipelineName, openlayerProjectName, openlayerServerUrl, }) {
@@ -34,17 +34,20 @@ class OpenAIMonitor {
34
34
  const uploadToInferencePipeline = (id) => __awaiter(this, void 0, void 0, function* () {
35
35
  const dataStreamEndpoint = `/inference-pipelines/${id}/data-stream`;
36
36
  const dataStreamQuery = this.resolvedQuery(dataStreamEndpoint);
37
- const response = yield (0, node_fetch_1.default)(dataStreamQuery, {
37
+ const response = yield fetch(dataStreamQuery, {
38
38
  body: JSON.stringify({
39
39
  config: {
40
- inferenceIdColumnName: 'inference_id',
40
+ groundTruthColumnName: null,
41
+ inferenceIdColumnName: 'id',
41
42
  inputVariableNames: ['input'],
42
43
  latencyColumnName: 'latency',
43
44
  outputColumnName: 'output',
44
45
  timestampColumnName: 'timestamp',
45
46
  tokensColumnName: 'tokens',
46
47
  },
47
- rows: [data],
48
+ rows: [
49
+ Object.assign({ id: (0, uuid_1.v4)() }, data),
50
+ ],
48
51
  }),
49
52
  headers: {
50
53
  Authorization: `Bearer ${this.openlayerApiKey}`,
@@ -67,7 +70,7 @@ class OpenAIMonitor {
67
70
  name: this.openlayerProjectName,
68
71
  };
69
72
  const projectsQuery = this.resolvedQuery(projectsEndpoint, projectsQueryParameters);
70
- const projectsResponse = yield (0, node_fetch_1.default)(projectsQuery, {
73
+ const projectsResponse = yield fetch(projectsQuery, {
71
74
  headers: {
72
75
  Authorization: `Bearer ${this.openlayerApiKey}`,
73
76
  'Content-Type': 'application/json',
@@ -87,7 +90,7 @@ class OpenAIMonitor {
87
90
  name: this.openlayerInferencePipelineName,
88
91
  };
89
92
  const inferencePipelineQuery = this.resolvedQuery(inferencePipelineEndpoint, inferencePipelineQueryParameters);
90
- const inferencePipelineResponse = yield (0, node_fetch_1.default)(inferencePipelineQuery, {
93
+ const inferencePipelineResponse = yield fetch(inferencePipelineQuery, {
91
94
  headers: {
92
95
  Authorization: `Bearer ${this.openlayerApiKey}`,
93
96
  'Content-Type': 'application/json',
@@ -106,7 +109,7 @@ class OpenAIMonitor {
106
109
  else {
107
110
  const createInferencePipelineEndpoint = `/projects/${project.id}/inference-pipelines`;
108
111
  const createInferencePipelineQuery = this.resolvedQuery(createInferencePipelineEndpoint);
109
- const createInferencePipelineResponse = yield (0, node_fetch_1.default)(createInferencePipelineQuery, {
112
+ const createInferencePipelineResponse = yield fetch(createInferencePipelineQuery, {
110
113
  body: JSON.stringify({
111
114
  description: '',
112
115
  name: typeof this.openlayerInferencePipelineName === 'undefined'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openlayer",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "The Openlayer TypeScript client",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,9 +19,11 @@
19
19
  "eslint-plugin-prettier": "^5.0.1",
20
20
  "eslint-plugin-typescript-sort-keys": "^3.1.0",
21
21
  "node-fetch": "^3.3.2",
22
- "openai": "^4.19.0"
22
+ "openai": "^4.19.0",
23
+ "uuid": "^9.0.1"
23
24
  },
24
25
  "devDependencies": {
26
+ "@types/uuid": "^9.0.7",
25
27
  "typescript": "^5.2.2"
26
28
  }
27
29
  }