notdiamond 0.3.4 → 0.3.5

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 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.3";
19
+ const version = "0.3.4";
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;
@@ -25,14 +25,16 @@ var __publicField = (obj, key, value) => {
25
25
  return value;
26
26
  };
27
27
  dotenv__namespace.config();
28
+ const DEFAULT_TIMEOUT = 5;
28
29
  const BASE_URL = "https://not-diamond-server.onrender.com";
29
30
  const MODEL_SELECT_URL = `${BASE_URL}/v2/modelRouter/modelSelect`;
30
31
  const FEEDBACK_URL = `${BASE_URL}/v2/report/metrics/feedback`;
31
- const DEFAULT_TIMEOUT = 5;
32
32
  class NotDiamond {
33
33
  constructor(options = {}) {
34
34
  __publicField(this, "apiKey");
35
+ __publicField(this, "apiUrl");
35
36
  this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
37
+ this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
36
38
  }
37
39
  getAuthHeader() {
38
40
  return `Bearer ${this.apiKey}`;
@@ -89,7 +91,10 @@ class NotDiamond {
89
91
  ...options.timeout ? { timeout: options.timeout } : {
90
92
  timeout: DEFAULT_TIMEOUT
91
93
  },
92
- ...options.default && { default: options.default }
94
+ ...options.default && { default: options.default },
95
+ ...options.previousSession && {
96
+ previous_session: options.previousSession
97
+ }
93
98
  };
94
99
  return this.postRequest(
95
100
  MODEL_SELECT_URL,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,6 @@
1
1
  interface NotDiamondOptions {
2
2
  apiKey?: string;
3
+ apiUrl?: string;
3
4
  }
4
5
  interface Provider {
5
6
  provider: string;
@@ -35,6 +36,7 @@ interface ModelSelectOptions {
35
36
  hashContent?: boolean;
36
37
  timeout?: number;
37
38
  default?: Provider | number | string;
39
+ previousSession?: string;
38
40
  }
39
41
  interface ModelSelectSuccessResponse {
40
42
  providers: Provider[];
@@ -54,6 +56,7 @@ interface FeedbackSuccessResponse {
54
56
  }
55
57
  declare class NotDiamond {
56
58
  private apiKey;
59
+ private apiUrl;
57
60
  constructor(options?: NotDiamondOptions);
58
61
  private getAuthHeader;
59
62
  private postRequest;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  interface NotDiamondOptions {
2
2
  apiKey?: string;
3
+ apiUrl?: string;
3
4
  }
4
5
  interface Provider {
5
6
  provider: string;
@@ -35,6 +36,7 @@ interface ModelSelectOptions {
35
36
  hashContent?: boolean;
36
37
  timeout?: number;
37
38
  default?: Provider | number | string;
39
+ previousSession?: string;
38
40
  }
39
41
  interface ModelSelectSuccessResponse {
40
42
  providers: Provider[];
@@ -54,6 +56,7 @@ interface FeedbackSuccessResponse {
54
56
  }
55
57
  declare class NotDiamond {
56
58
  private apiKey;
59
+ private apiUrl;
57
60
  constructor(options?: NotDiamondOptions);
58
61
  private getAuthHeader;
59
62
  private postRequest;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  interface NotDiamondOptions {
2
2
  apiKey?: string;
3
+ apiUrl?: string;
3
4
  }
4
5
  interface Provider {
5
6
  provider: string;
@@ -35,6 +36,7 @@ interface ModelSelectOptions {
35
36
  hashContent?: boolean;
36
37
  timeout?: number;
37
38
  default?: Provider | number | string;
39
+ previousSession?: string;
38
40
  }
39
41
  interface ModelSelectSuccessResponse {
40
42
  providers: Provider[];
@@ -54,6 +56,7 @@ interface FeedbackSuccessResponse {
54
56
  }
55
57
  declare class NotDiamond {
56
58
  private apiKey;
59
+ private apiUrl;
57
60
  constructor(options?: NotDiamondOptions);
58
61
  private getAuthHeader;
59
62
  private postRequest;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as dotenv from 'dotenv';
2
2
 
3
- const version = "0.3.3";
3
+ const version = "0.3.4";
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;
@@ -9,14 +9,16 @@ var __publicField = (obj, key, value) => {
9
9
  return value;
10
10
  };
11
11
  dotenv.config();
12
+ const DEFAULT_TIMEOUT = 5;
12
13
  const BASE_URL = "https://not-diamond-server.onrender.com";
13
14
  const MODEL_SELECT_URL = `${BASE_URL}/v2/modelRouter/modelSelect`;
14
15
  const FEEDBACK_URL = `${BASE_URL}/v2/report/metrics/feedback`;
15
- const DEFAULT_TIMEOUT = 5;
16
16
  class NotDiamond {
17
17
  constructor(options = {}) {
18
18
  __publicField(this, "apiKey");
19
+ __publicField(this, "apiUrl");
19
20
  this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
21
+ this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
20
22
  }
21
23
  getAuthHeader() {
22
24
  return `Bearer ${this.apiKey}`;
@@ -73,7 +75,10 @@ class NotDiamond {
73
75
  ...options.timeout ? { timeout: options.timeout } : {
74
76
  timeout: DEFAULT_TIMEOUT
75
77
  },
76
- ...options.default && { default: options.default }
78
+ ...options.default && { default: options.default },
79
+ ...options.previousSession && {
80
+ previous_session: options.previousSession
81
+ }
77
82
  };
78
83
  return this.postRequest(
79
84
  MODEL_SELECT_URL,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "notdiamond",
3
3
  "type": "module",
4
- "version": "0.3.4",
4
+ "version": "0.3.5",
5
5
  "author": "not-diamond",
6
6
  "license": "MIT",
7
7
  "description": "TS/JS client for the NotDiamond API",