notdiamond 0.3.3 → 0.3.4

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.2";
19
+ const version = "0.3.3";
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;
@@ -33,16 +33,11 @@ class NotDiamond {
33
33
  constructor(options = {}) {
34
34
  __publicField(this, "apiKey");
35
35
  this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
36
- console.log("NotDiamond initialized with apiKey:", this.apiKey);
37
36
  }
38
37
  getAuthHeader() {
39
- const authHeader = `Bearer ${this.apiKey}`;
40
- console.log("Generated auth header:", authHeader);
41
- return authHeader;
38
+ return `Bearer ${this.apiKey}`;
42
39
  }
43
40
  async postRequest(url, body) {
44
- console.log("Sending POST request to URL:", url);
45
- console.log("Request body:", body);
46
41
  try {
47
42
  const response = await fetch(url, {
48
43
  method: "POST",
@@ -54,22 +49,16 @@ class NotDiamond {
54
49
  },
55
50
  body: JSON.stringify(body)
56
51
  });
57
- console.log("Response status:", response.status);
58
52
  if (!response.ok) {
59
53
  const errorData = await response.json();
60
- console.error("Error response data:", errorData);
61
54
  return { detail: errorData.detail };
62
55
  }
63
- const responseData = await response.json();
64
- console.log("Response data:", responseData);
65
- return responseData;
56
+ return await response.json();
66
57
  } catch (error) {
67
- console.error("An unexpected error occurred:", error);
68
58
  return { detail: "An unexpected error occurred." };
69
59
  }
70
60
  }
71
61
  async modelSelect(options) {
72
- console.log("Calling modelSelect with options:", options);
73
62
  const requestBody = {
74
63
  messages: options.messages,
75
64
  llm_providers: options.llmProviders.map((provider) => ({
@@ -102,14 +91,12 @@ class NotDiamond {
102
91
  },
103
92
  ...options.default && { default: options.default }
104
93
  };
105
- console.log("Request body:", JSON.stringify(requestBody, null, 2));
106
94
  return this.postRequest(
107
95
  MODEL_SELECT_URL,
108
96
  requestBody
109
97
  );
110
98
  }
111
99
  async feedback(options) {
112
- console.log("Calling feedback with options:", options);
113
100
  return this.postRequest(FEEDBACK_URL, {
114
101
  session_id: options.sessionId,
115
102
  feedback: options.feedback,
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as dotenv from 'dotenv';
2
2
 
3
- const version = "0.3.2";
3
+ const version = "0.3.3";
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;
@@ -17,16 +17,11 @@ class NotDiamond {
17
17
  constructor(options = {}) {
18
18
  __publicField(this, "apiKey");
19
19
  this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
20
- console.log("NotDiamond initialized with apiKey:", this.apiKey);
21
20
  }
22
21
  getAuthHeader() {
23
- const authHeader = `Bearer ${this.apiKey}`;
24
- console.log("Generated auth header:", authHeader);
25
- return authHeader;
22
+ return `Bearer ${this.apiKey}`;
26
23
  }
27
24
  async postRequest(url, body) {
28
- console.log("Sending POST request to URL:", url);
29
- console.log("Request body:", body);
30
25
  try {
31
26
  const response = await fetch(url, {
32
27
  method: "POST",
@@ -38,22 +33,16 @@ class NotDiamond {
38
33
  },
39
34
  body: JSON.stringify(body)
40
35
  });
41
- console.log("Response status:", response.status);
42
36
  if (!response.ok) {
43
37
  const errorData = await response.json();
44
- console.error("Error response data:", errorData);
45
38
  return { detail: errorData.detail };
46
39
  }
47
- const responseData = await response.json();
48
- console.log("Response data:", responseData);
49
- return responseData;
40
+ return await response.json();
50
41
  } catch (error) {
51
- console.error("An unexpected error occurred:", error);
52
42
  return { detail: "An unexpected error occurred." };
53
43
  }
54
44
  }
55
45
  async modelSelect(options) {
56
- console.log("Calling modelSelect with options:", options);
57
46
  const requestBody = {
58
47
  messages: options.messages,
59
48
  llm_providers: options.llmProviders.map((provider) => ({
@@ -86,14 +75,12 @@ class NotDiamond {
86
75
  },
87
76
  ...options.default && { default: options.default }
88
77
  };
89
- console.log("Request body:", JSON.stringify(requestBody, null, 2));
90
78
  return this.postRequest(
91
79
  MODEL_SELECT_URL,
92
80
  requestBody
93
81
  );
94
82
  }
95
83
  async feedback(options) {
96
- console.log("Calling feedback with options:", options);
97
84
  return this.postRequest(FEEDBACK_URL, {
98
85
  session_id: options.sessionId,
99
86
  feedback: options.feedback,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "notdiamond",
3
3
  "type": "module",
4
- "version": "0.3.3",
4
+ "version": "0.3.4",
5
5
  "author": "not-diamond",
6
6
  "license": "MIT",
7
7
  "description": "TS/JS client for the NotDiamond API",