notdiamond 0.3.5 → 0.3.8
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.cjs +7 -5
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +7 -5
- package/package.json +1 -1
- package/CHANGELOG.md +0 -11
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ function _interopNamespaceCompat(e) {
|
|
|
16
16
|
|
|
17
17
|
const dotenv__namespace = /*#__PURE__*/_interopNamespaceCompat(dotenv);
|
|
18
18
|
|
|
19
|
-
const version = "0.3.
|
|
19
|
+
const version = "0.3.7";
|
|
20
20
|
|
|
21
21
|
var __defProp = Object.defineProperty;
|
|
22
22
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -27,14 +27,16 @@ var __publicField = (obj, key, value) => {
|
|
|
27
27
|
dotenv__namespace.config();
|
|
28
28
|
const DEFAULT_TIMEOUT = 5;
|
|
29
29
|
const BASE_URL = "https://not-diamond-server.onrender.com";
|
|
30
|
-
const MODEL_SELECT_URL = `${BASE_URL}/v2/modelRouter/modelSelect`;
|
|
31
|
-
const FEEDBACK_URL = `${BASE_URL}/v2/report/metrics/feedback`;
|
|
32
30
|
class NotDiamond {
|
|
33
31
|
constructor(options = {}) {
|
|
34
32
|
__publicField(this, "apiKey");
|
|
35
33
|
__publicField(this, "apiUrl");
|
|
34
|
+
__publicField(this, "modelSelectUrl");
|
|
35
|
+
__publicField(this, "feedbackUrl");
|
|
36
36
|
this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
|
|
37
37
|
this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
|
|
38
|
+
this.modelSelectUrl = `${this.apiUrl}/v2/modelRouter/modelSelect`;
|
|
39
|
+
this.feedbackUrl = `${this.apiUrl}/v2/report/metrics/feedback`;
|
|
38
40
|
}
|
|
39
41
|
getAuthHeader() {
|
|
40
42
|
return `Bearer ${this.apiKey}`;
|
|
@@ -97,12 +99,12 @@ class NotDiamond {
|
|
|
97
99
|
}
|
|
98
100
|
};
|
|
99
101
|
return this.postRequest(
|
|
100
|
-
|
|
102
|
+
this.modelSelectUrl,
|
|
101
103
|
requestBody
|
|
102
104
|
);
|
|
103
105
|
}
|
|
104
106
|
async feedback(options) {
|
|
105
|
-
return this.postRequest(
|
|
107
|
+
return this.postRequest(this.feedbackUrl, {
|
|
106
108
|
session_id: options.sessionId,
|
|
107
109
|
feedback: options.feedback,
|
|
108
110
|
provider: options.provider
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dotenv from 'dotenv';
|
|
2
2
|
|
|
3
|
-
const version = "0.3.
|
|
3
|
+
const version = "0.3.7";
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -11,14 +11,16 @@ var __publicField = (obj, key, value) => {
|
|
|
11
11
|
dotenv.config();
|
|
12
12
|
const DEFAULT_TIMEOUT = 5;
|
|
13
13
|
const BASE_URL = "https://not-diamond-server.onrender.com";
|
|
14
|
-
const MODEL_SELECT_URL = `${BASE_URL}/v2/modelRouter/modelSelect`;
|
|
15
|
-
const FEEDBACK_URL = `${BASE_URL}/v2/report/metrics/feedback`;
|
|
16
14
|
class NotDiamond {
|
|
17
15
|
constructor(options = {}) {
|
|
18
16
|
__publicField(this, "apiKey");
|
|
19
17
|
__publicField(this, "apiUrl");
|
|
18
|
+
__publicField(this, "modelSelectUrl");
|
|
19
|
+
__publicField(this, "feedbackUrl");
|
|
20
20
|
this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
|
|
21
21
|
this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
|
|
22
|
+
this.modelSelectUrl = `${this.apiUrl}/v2/modelRouter/modelSelect`;
|
|
23
|
+
this.feedbackUrl = `${this.apiUrl}/v2/report/metrics/feedback`;
|
|
22
24
|
}
|
|
23
25
|
getAuthHeader() {
|
|
24
26
|
return `Bearer ${this.apiKey}`;
|
|
@@ -81,12 +83,12 @@ class NotDiamond {
|
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
return this.postRequest(
|
|
84
|
-
|
|
86
|
+
this.modelSelectUrl,
|
|
85
87
|
requestBody
|
|
86
88
|
);
|
|
87
89
|
}
|
|
88
90
|
async feedback(options) {
|
|
89
|
-
return this.postRequest(
|
|
91
|
+
return this.postRequest(this.feedbackUrl, {
|
|
90
92
|
session_id: options.sessionId,
|
|
91
93
|
feedback: options.feedback,
|
|
92
94
|
provider: options.provider
|
package/package.json
CHANGED
package/CHANGELOG.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
## [0.0.2](https://github.com/Not-Diamond/notdiamond-node/pull/4) (2024-05-22)
|
|
2
|
-
|
|
3
|
-
### Bug Fixes
|
|
4
|
-
|
|
5
|
-
- Cleaned up readme [4c33bd8be65850ef4c5ca34aa9d18c60ee44ead5](https://github.com/Not-Diamond/notdiamond-node/pull/4/commits/4c33bd8be65850ef4c5ca34aa9d18c60ee44ead5)
|
|
6
|
-
|
|
7
|
-
## [0.0.1](https://github.com/Not-Diamond/notdiamond-node/tree/32bccf352544414e1486c170b90cf00f75041190) (2024-05-22)
|
|
8
|
-
|
|
9
|
-
### Initial release
|
|
10
|
-
|
|
11
|
-
- Code setup
|