notdiamond 1.1.0 → 1.1.2

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
@@ -28,167 +28,23 @@ function _interopNamespaceCompat(e) {
28
28
  const dotenv__namespace = /*#__PURE__*/_interopNamespaceCompat(dotenv);
29
29
  const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
30
30
 
31
- const name = "notdiamond";
32
- const type = "module";
33
- const version = "1.0.10";
34
- const author = "not-diamond";
35
- const license = "MIT";
36
- const description = "TS/JS client for the NotDiamond API";
37
- const main = "./dist/index.cjs";
38
- const exports$1 = {
39
- ".": {
40
- "import": "./dist/index.mjs",
41
- require: "./dist/index.cjs"
42
- }
43
- };
44
- const types = "./dist/index.d.ts";
45
- const repository = {
46
- type: "git",
47
- url: "https://github.com/Not-Diamond/notdiamond-node.git"
48
- };
49
- const bugs = {
50
- url: "https://github.com/Not-Diamond/notdiamond-node/issues"
51
- };
52
- const homepage = "https://github.com/Not-Diamond/notdiamond-node#readme";
53
- const files = [
54
- "dist"
55
- ];
56
- const keywords = [
57
- "ai",
58
- "not-diamond",
59
- "typescript",
60
- "openai",
61
- "chatgpt",
62
- "anthropic",
63
- "claude",
64
- "gemini",
65
- "model router"
66
- ];
67
- const scripts = {
68
- prepare: "husky install",
69
- "start:cjs": "node ./dist/index.cjs",
70
- "start:esm": "node ./dist/index.mjs",
71
- dev: "nodemon",
72
- develop: "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./src/index.ts",
73
- test: "jest --passWithNoTests",
74
- "test:watch": "jest --watch --passWithNoTests",
75
- "test:coverage": "jest --coverage --passWithNoTests",
76
- clean: "rimraf build && rimraf dist",
77
- build: "swc ./src -d build",
78
- "build:watch": "swc ./src -d build -w",
79
- lint: "eslint ./src --ext .ts",
80
- "lint:fix": "eslint ./src --ext .ts --fix",
81
- prettier: "prettier '**/*.{ts,json,md}'",
82
- "prettier:write": "prettier --write '**/*.{ts,json,md}'",
83
- "type-check": "tsc --noEmit",
84
- "lint-staged": "lint-staged",
85
- release: "semantic-release",
86
- bundle: "unbuild"
87
- };
88
- const dependencies = {
89
- "@langchain/anthropic": "^0.3.1",
90
- "@langchain/cohere": "^0.3.0",
91
- "@langchain/community": "^0.3.3",
92
- "@langchain/core": "^0.3.3",
93
- "@langchain/google-genai": "^0.1.0",
94
- "@langchain/mistralai": "^0.1.1",
95
- "@langchain/openai": "^0.3.0",
96
- "ansi-styles": "^6.2.1",
97
- axios: "^1.7.7",
98
- camelcase: "^8.0.0",
99
- decamelize: "^6.0.0",
100
- dotenv: "^16.4.5",
101
- eventemitter3: "^5.0.1",
102
- langchain: "^0.3.2",
103
- langsmith: "^0.1.60",
104
- "p-finally": "^2.0.1",
105
- "p-queue": "^8.0.1",
106
- "p-retry": "^6.2.0",
107
- "p-timeout": "^6.1.2",
108
- retry: "^0.13.1",
109
- semver: "^7.6.3",
110
- uuid: "^10.0.0",
111
- zod: "^3.23.8",
112
- "zod-to-json-schema": "^3.23.3"
113
- };
114
- const devDependencies = {
115
- "@semantic-release/changelog": "^6.0.3",
116
- "@semantic-release/commit-analyzer": "^12.0.0",
117
- "@semantic-release/git": "^10.0.1",
118
- "@semantic-release/github": "^10.0.0",
119
- "@semantic-release/npm": "^12.0.0",
120
- "@semantic-release/release-notes-generator": "^13.0.0",
121
- "@swc/cli": "0.3.12",
122
- "@swc/core": "1.5.7",
123
- "@swc/jest": "0.2.36",
124
- "@types/jest": "29.5.12",
125
- "@types/node": "20.12.12",
126
- "@typescript-eslint/eslint-plugin": "7.9.0",
127
- "@typescript-eslint/parser": "7.9.0",
128
- eslint: "8.57.0",
129
- "eslint-config-prettier": "9.1.0",
130
- "eslint-plugin-jest": "27.9.0",
131
- "eslint-plugin-prettier": "5.1.3",
132
- husky: "^9.0.0",
133
- jest: "29.7.0",
134
- "lint-staged": "^15.0.0",
135
- nodemon: "3.1.0",
136
- prettier: "3.2.5",
137
- "regenerator-runtime": "^0.14.0",
138
- rimraf: "5.0.7",
139
- "semantic-release": "^23.0.0",
140
- "ts-node": "^10.9.1",
141
- typescript: "5.4.5",
142
- unbuild: "^2.0.0"
143
- };
144
- const resolutions = {
145
- "wrap-ansi": "7.0.0"
146
- };
147
- const engines = {
148
- node: ">=20",
149
- npm: ">=8"
150
- };
31
+ const version = "1.1.1";
151
32
  const packageJson = {
152
- name: name,
153
- type: type,
154
- version: version,
155
- author: author,
156
- license: license,
157
- description: description,
158
- main: main,
159
- exports: exports$1,
160
- types: types,
161
- repository: repository,
162
- bugs: bugs,
163
- homepage: homepage,
164
- files: files,
165
- keywords: keywords,
166
- scripts: scripts,
167
- dependencies: dependencies,
168
- devDependencies: devDependencies,
169
- resolutions: resolutions,
170
- engines: engines
171
- };
33
+ version: version};
172
34
 
173
- var __defProp$1 = Object.defineProperty;
174
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
175
- var __publicField$1 = (obj, key, value) => {
176
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
177
- return value;
178
- };
179
35
  class ChatPerplexity extends chat_models.BaseChatModel {
180
- constructor({ apiKey, model }) {
181
- super({});
182
- __publicField$1(this, "apiKey");
183
- __publicField$1(this, "model");
184
- this.apiKey = apiKey;
185
- this.model = model;
186
- }
187
36
  _generate(messages, options, runManager) {
188
37
  throw new Error(
189
38
  "Method not implemented." + JSON.stringify(messages) + JSON.stringify(options) + JSON.stringify(runManager)
190
39
  );
191
40
  }
41
+ apiKey;
42
+ model;
43
+ constructor({ apiKey, model }) {
44
+ super({});
45
+ this.apiKey = apiKey;
46
+ this.model = model;
47
+ }
192
48
  _llmType() {
193
49
  return "perplexity";
194
50
  }
@@ -248,6 +104,8 @@ const SupportedModel = {
248
104
  GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18",
249
105
  GPT_4O_MINI: "gpt-4o-mini",
250
106
  GPT_4_0125_PREVIEW: "gpt-4-0125-preview",
107
+ GPT_4_5_PREVIEW: "gpt-4.5-preview",
108
+ GPT_4_5_PREVIEW_2025_02_27: "gpt-4.5-preview-2025-02-27",
251
109
  CHATGPT_4O_LATEST: "chatgpt-4o-latest",
252
110
  O1_PREVIEW: "o1-preview",
253
111
  O1_PREVIEW_2024_09_12: "o1-preview-2024-09-12",
@@ -261,11 +119,15 @@ const SupportedModel = {
261
119
  CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest",
262
120
  CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307",
263
121
  CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022",
122
+ CLAUDE_3_7_SONNET_LATEST: "claude-3-7-sonnet-latest",
123
+ CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219",
264
124
  GEMINI_PRO: "gemini-pro",
265
125
  GEMINI_1_PRO_LATEST: "gemini-1.0-pro-latest",
266
126
  GEMINI_15_PRO_LATEST: "gemini-1.5-pro-latest",
267
127
  GEMINI_15_PRO_EXP_0801: "gemini-1.5-pro-exp-0801",
268
128
  GEMINI_15_FLASH_LATEST: "gemini-1.5-flash-latest",
129
+ GEMINI_2_0_FLASH: "gemini-2.0-flash",
130
+ GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001",
269
131
  COMMAND_R: "command-r",
270
132
  COMMAND_R_PLUS: "command-r-plus",
271
133
  MISTRAL_LARGE_LATEST: "mistral-large-latest",
@@ -310,7 +172,9 @@ const SupportedModel = {
310
172
  SupportedModel.O1_PREVIEW_2024_09_12,
311
173
  SupportedModel.O1_MINI,
312
174
  SupportedModel.O1_MINI_2024_09_12,
313
- SupportedModel.CHATGPT_4O_LATEST
175
+ SupportedModel.CHATGPT_4O_LATEST,
176
+ SupportedModel.GPT_4_5_PREVIEW,
177
+ SupportedModel.GPT_4_5_PREVIEW_2025_02_27
314
178
  ],
315
179
  [SupportedProvider.ANTHROPIC]: [
316
180
  SupportedModel.CLAUDE_2_1,
@@ -320,14 +184,18 @@ const SupportedModel = {
320
184
  SupportedModel.CLAUDE_3_5_SONNET_20241022,
321
185
  SupportedModel.CLAUDE_3_5_SONNET_LATEST,
322
186
  SupportedModel.CLAUDE_3_HAIKU_20240307,
323
- SupportedModel.CLAUDE_3_5_HAIKU_20241022
187
+ SupportedModel.CLAUDE_3_5_HAIKU_20241022,
188
+ SupportedModel.CLAUDE_3_7_SONNET_LATEST,
189
+ SupportedModel.CLAUDE_3_7_SONNET_20250219
324
190
  ],
325
191
  [SupportedProvider.GOOGLE]: [
326
192
  SupportedModel.GEMINI_PRO,
327
193
  SupportedModel.GEMINI_1_PRO_LATEST,
328
194
  SupportedModel.GEMINI_15_PRO_LATEST,
329
195
  SupportedModel.GEMINI_15_PRO_EXP_0801,
330
- SupportedModel.GEMINI_15_FLASH_LATEST
196
+ SupportedModel.GEMINI_15_FLASH_LATEST,
197
+ SupportedModel.GEMINI_2_0_FLASH,
198
+ SupportedModel.GEMINI_2_0_FLASH_001
331
199
  ],
332
200
  [SupportedProvider.MISTRAL]: [
333
201
  SupportedModel.MISTRAL_LARGE_LATEST,
@@ -508,24 +376,18 @@ function extractContent(response) {
508
376
  return typeof response === "string" ? response : JSON.stringify(response);
509
377
  }
510
378
 
511
- var __defProp = Object.defineProperty;
512
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
513
- var __publicField = (obj, key, value) => {
514
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
515
- return value;
516
- };
517
379
  const SDK_VERSION = packageJson.version;
518
380
  dotenv__namespace.config();
519
381
  const DEFAULT_TIMEOUT = 5;
520
382
  const BASE_URL = "https://api.notdiamond.ai";
521
383
  class NotDiamond {
384
+ apiKey;
385
+ apiUrl;
386
+ modelSelectUrl;
387
+ feedbackUrl;
388
+ createUrl;
389
+ llmKeys;
522
390
  constructor(options = {}) {
523
- __publicField(this, "apiKey");
524
- __publicField(this, "apiUrl");
525
- __publicField(this, "modelSelectUrl");
526
- __publicField(this, "feedbackUrl");
527
- __publicField(this, "createUrl");
528
- __publicField(this, "llmKeys");
529
391
  this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
530
392
  this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
531
393
  this.llmKeys = options.llmKeys || {};
package/dist/index.d.cts CHANGED
@@ -24,6 +24,8 @@ declare const SupportedModel: {
24
24
  readonly GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18";
25
25
  readonly GPT_4O_MINI: "gpt-4o-mini";
26
26
  readonly GPT_4_0125_PREVIEW: "gpt-4-0125-preview";
27
+ readonly GPT_4_5_PREVIEW: "gpt-4.5-preview";
28
+ readonly GPT_4_5_PREVIEW_2025_02_27: "gpt-4.5-preview-2025-02-27";
27
29
  readonly CHATGPT_4O_LATEST: "chatgpt-4o-latest";
28
30
  readonly O1_PREVIEW: "o1-preview";
29
31
  readonly O1_PREVIEW_2024_09_12: "o1-preview-2024-09-12";
@@ -37,11 +39,15 @@ declare const SupportedModel: {
37
39
  readonly CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest";
38
40
  readonly CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307";
39
41
  readonly CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022";
42
+ readonly CLAUDE_3_7_SONNET_LATEST: "claude-3-7-sonnet-latest";
43
+ readonly CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219";
40
44
  readonly GEMINI_PRO: "gemini-pro";
41
45
  readonly GEMINI_1_PRO_LATEST: "gemini-1.0-pro-latest";
42
46
  readonly GEMINI_15_PRO_LATEST: "gemini-1.5-pro-latest";
43
47
  readonly GEMINI_15_PRO_EXP_0801: "gemini-1.5-pro-exp-0801";
44
48
  readonly GEMINI_15_FLASH_LATEST: "gemini-1.5-flash-latest";
49
+ readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
50
+ readonly GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001";
45
51
  readonly COMMAND_R: "command-r";
46
52
  readonly COMMAND_R_PLUS: "command-r-plus";
47
53
  readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
@@ -67,9 +73,9 @@ declare const SupportedModel: {
67
73
  readonly DEEPSEEK_R1: "DeepSeek-R1";
68
74
  };
69
75
  declare const ProviderModelMap: {
70
- readonly openai: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-0125", "gpt-4", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4-turbo-2024-04-09", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o", "gpt-4o-mini-2024-07-18", "gpt-4o-mini", "gpt-4-0125-preview", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "chatgpt-4o-latest"];
71
- readonly anthropic: readonly ["claude-2.1", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-latest", "claude-3-haiku-20240307", "claude-3-5-haiku-20241022"];
72
- readonly google: readonly ["gemini-pro", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash-latest"];
76
+ readonly openai: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-0125", "gpt-4", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4-turbo-2024-04-09", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o", "gpt-4o-mini-2024-07-18", "gpt-4o-mini", "gpt-4-0125-preview", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "chatgpt-4o-latest", "gpt-4.5-preview", "gpt-4.5-preview-2025-02-27"];
77
+ readonly anthropic: readonly ["claude-2.1", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-latest", "claude-3-haiku-20240307", "claude-3-5-haiku-20241022", "claude-3-7-sonnet-latest", "claude-3-7-sonnet-20250219"];
78
+ readonly google: readonly ["gemini-pro", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash-latest", "gemini-2.0-flash", "gemini-2.0-flash-001"];
73
79
  readonly mistral: readonly ["mistral-large-latest", "mistral-large-2407", "mistral-large-2402", "mistral-medium-latest", "mistral-small-latest", "codestral-latest", "open-mistral-7b", "open-mixtral-8x7b", "open-mixtral-8x22b", "open-mistral-nemo"];
74
80
  readonly perplexity: readonly ["sonar"];
75
81
  readonly cohere: readonly ["command-r", "command-r-plus"];
package/dist/index.d.mts CHANGED
@@ -24,6 +24,8 @@ declare const SupportedModel: {
24
24
  readonly GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18";
25
25
  readonly GPT_4O_MINI: "gpt-4o-mini";
26
26
  readonly GPT_4_0125_PREVIEW: "gpt-4-0125-preview";
27
+ readonly GPT_4_5_PREVIEW: "gpt-4.5-preview";
28
+ readonly GPT_4_5_PREVIEW_2025_02_27: "gpt-4.5-preview-2025-02-27";
27
29
  readonly CHATGPT_4O_LATEST: "chatgpt-4o-latest";
28
30
  readonly O1_PREVIEW: "o1-preview";
29
31
  readonly O1_PREVIEW_2024_09_12: "o1-preview-2024-09-12";
@@ -37,11 +39,15 @@ declare const SupportedModel: {
37
39
  readonly CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest";
38
40
  readonly CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307";
39
41
  readonly CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022";
42
+ readonly CLAUDE_3_7_SONNET_LATEST: "claude-3-7-sonnet-latest";
43
+ readonly CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219";
40
44
  readonly GEMINI_PRO: "gemini-pro";
41
45
  readonly GEMINI_1_PRO_LATEST: "gemini-1.0-pro-latest";
42
46
  readonly GEMINI_15_PRO_LATEST: "gemini-1.5-pro-latest";
43
47
  readonly GEMINI_15_PRO_EXP_0801: "gemini-1.5-pro-exp-0801";
44
48
  readonly GEMINI_15_FLASH_LATEST: "gemini-1.5-flash-latest";
49
+ readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
50
+ readonly GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001";
45
51
  readonly COMMAND_R: "command-r";
46
52
  readonly COMMAND_R_PLUS: "command-r-plus";
47
53
  readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
@@ -67,9 +73,9 @@ declare const SupportedModel: {
67
73
  readonly DEEPSEEK_R1: "DeepSeek-R1";
68
74
  };
69
75
  declare const ProviderModelMap: {
70
- readonly openai: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-0125", "gpt-4", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4-turbo-2024-04-09", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o", "gpt-4o-mini-2024-07-18", "gpt-4o-mini", "gpt-4-0125-preview", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "chatgpt-4o-latest"];
71
- readonly anthropic: readonly ["claude-2.1", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-latest", "claude-3-haiku-20240307", "claude-3-5-haiku-20241022"];
72
- readonly google: readonly ["gemini-pro", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash-latest"];
76
+ readonly openai: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-0125", "gpt-4", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4-turbo-2024-04-09", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o", "gpt-4o-mini-2024-07-18", "gpt-4o-mini", "gpt-4-0125-preview", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "chatgpt-4o-latest", "gpt-4.5-preview", "gpt-4.5-preview-2025-02-27"];
77
+ readonly anthropic: readonly ["claude-2.1", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-latest", "claude-3-haiku-20240307", "claude-3-5-haiku-20241022", "claude-3-7-sonnet-latest", "claude-3-7-sonnet-20250219"];
78
+ readonly google: readonly ["gemini-pro", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash-latest", "gemini-2.0-flash", "gemini-2.0-flash-001"];
73
79
  readonly mistral: readonly ["mistral-large-latest", "mistral-large-2407", "mistral-large-2402", "mistral-medium-latest", "mistral-small-latest", "codestral-latest", "open-mistral-7b", "open-mixtral-8x7b", "open-mixtral-8x22b", "open-mistral-nemo"];
74
80
  readonly perplexity: readonly ["sonar"];
75
81
  readonly cohere: readonly ["command-r", "command-r-plus"];
package/dist/index.d.ts CHANGED
@@ -24,6 +24,8 @@ declare const SupportedModel: {
24
24
  readonly GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18";
25
25
  readonly GPT_4O_MINI: "gpt-4o-mini";
26
26
  readonly GPT_4_0125_PREVIEW: "gpt-4-0125-preview";
27
+ readonly GPT_4_5_PREVIEW: "gpt-4.5-preview";
28
+ readonly GPT_4_5_PREVIEW_2025_02_27: "gpt-4.5-preview-2025-02-27";
27
29
  readonly CHATGPT_4O_LATEST: "chatgpt-4o-latest";
28
30
  readonly O1_PREVIEW: "o1-preview";
29
31
  readonly O1_PREVIEW_2024_09_12: "o1-preview-2024-09-12";
@@ -37,11 +39,15 @@ declare const SupportedModel: {
37
39
  readonly CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest";
38
40
  readonly CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307";
39
41
  readonly CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022";
42
+ readonly CLAUDE_3_7_SONNET_LATEST: "claude-3-7-sonnet-latest";
43
+ readonly CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219";
40
44
  readonly GEMINI_PRO: "gemini-pro";
41
45
  readonly GEMINI_1_PRO_LATEST: "gemini-1.0-pro-latest";
42
46
  readonly GEMINI_15_PRO_LATEST: "gemini-1.5-pro-latest";
43
47
  readonly GEMINI_15_PRO_EXP_0801: "gemini-1.5-pro-exp-0801";
44
48
  readonly GEMINI_15_FLASH_LATEST: "gemini-1.5-flash-latest";
49
+ readonly GEMINI_2_0_FLASH: "gemini-2.0-flash";
50
+ readonly GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001";
45
51
  readonly COMMAND_R: "command-r";
46
52
  readonly COMMAND_R_PLUS: "command-r-plus";
47
53
  readonly MISTRAL_LARGE_LATEST: "mistral-large-latest";
@@ -67,9 +73,9 @@ declare const SupportedModel: {
67
73
  readonly DEEPSEEK_R1: "DeepSeek-R1";
68
74
  };
69
75
  declare const ProviderModelMap: {
70
- readonly openai: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-0125", "gpt-4", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4-turbo-2024-04-09", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o", "gpt-4o-mini-2024-07-18", "gpt-4o-mini", "gpt-4-0125-preview", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "chatgpt-4o-latest"];
71
- readonly anthropic: readonly ["claude-2.1", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-latest", "claude-3-haiku-20240307", "claude-3-5-haiku-20241022"];
72
- readonly google: readonly ["gemini-pro", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash-latest"];
76
+ readonly openai: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-0125", "gpt-4", "gpt-4-0613", "gpt-4-1106-preview", "gpt-4-turbo", "gpt-4-turbo-preview", "gpt-4-turbo-2024-04-09", "gpt-4o-2024-05-13", "gpt-4o-2024-08-06", "gpt-4o", "gpt-4o-mini-2024-07-18", "gpt-4o-mini", "gpt-4-0125-preview", "o1-preview", "o1-preview-2024-09-12", "o1-mini", "o1-mini-2024-09-12", "chatgpt-4o-latest", "gpt-4.5-preview", "gpt-4.5-preview-2025-02-27"];
77
+ readonly anthropic: readonly ["claude-2.1", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-5-sonnet-20240620", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-latest", "claude-3-haiku-20240307", "claude-3-5-haiku-20241022", "claude-3-7-sonnet-latest", "claude-3-7-sonnet-20250219"];
78
+ readonly google: readonly ["gemini-pro", "gemini-1.0-pro-latest", "gemini-1.5-pro-latest", "gemini-1.5-pro-exp-0801", "gemini-1.5-flash-latest", "gemini-2.0-flash", "gemini-2.0-flash-001"];
73
79
  readonly mistral: readonly ["mistral-large-latest", "mistral-large-2407", "mistral-large-2402", "mistral-medium-latest", "mistral-small-latest", "codestral-latest", "open-mistral-7b", "open-mixtral-8x7b", "open-mixtral-8x22b", "open-mistral-nemo"];
74
80
  readonly perplexity: readonly ["sonar"];
75
81
  readonly cohere: readonly ["command-r", "command-r-plus"];
package/dist/index.mjs CHANGED
@@ -9,167 +9,23 @@ import axios from 'axios';
9
9
  import { ChatCohere } from '@langchain/cohere';
10
10
  import { ChatTogetherAI } from '@langchain/community/chat_models/togetherai';
11
11
 
12
- const name = "notdiamond";
13
- const type = "module";
14
- const version = "1.0.10";
15
- const author = "not-diamond";
16
- const license = "MIT";
17
- const description = "TS/JS client for the NotDiamond API";
18
- const main = "./dist/index.cjs";
19
- const exports = {
20
- ".": {
21
- "import": "./dist/index.mjs",
22
- require: "./dist/index.cjs"
23
- }
24
- };
25
- const types = "./dist/index.d.ts";
26
- const repository = {
27
- type: "git",
28
- url: "https://github.com/Not-Diamond/notdiamond-node.git"
29
- };
30
- const bugs = {
31
- url: "https://github.com/Not-Diamond/notdiamond-node/issues"
32
- };
33
- const homepage = "https://github.com/Not-Diamond/notdiamond-node#readme";
34
- const files = [
35
- "dist"
36
- ];
37
- const keywords = [
38
- "ai",
39
- "not-diamond",
40
- "typescript",
41
- "openai",
42
- "chatgpt",
43
- "anthropic",
44
- "claude",
45
- "gemini",
46
- "model router"
47
- ];
48
- const scripts = {
49
- prepare: "husky install",
50
- "start:cjs": "node ./dist/index.cjs",
51
- "start:esm": "node ./dist/index.mjs",
52
- dev: "nodemon",
53
- develop: "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./src/index.ts",
54
- test: "jest --passWithNoTests",
55
- "test:watch": "jest --watch --passWithNoTests",
56
- "test:coverage": "jest --coverage --passWithNoTests",
57
- clean: "rimraf build && rimraf dist",
58
- build: "swc ./src -d build",
59
- "build:watch": "swc ./src -d build -w",
60
- lint: "eslint ./src --ext .ts",
61
- "lint:fix": "eslint ./src --ext .ts --fix",
62
- prettier: "prettier '**/*.{ts,json,md}'",
63
- "prettier:write": "prettier --write '**/*.{ts,json,md}'",
64
- "type-check": "tsc --noEmit",
65
- "lint-staged": "lint-staged",
66
- release: "semantic-release",
67
- bundle: "unbuild"
68
- };
69
- const dependencies = {
70
- "@langchain/anthropic": "^0.3.1",
71
- "@langchain/cohere": "^0.3.0",
72
- "@langchain/community": "^0.3.3",
73
- "@langchain/core": "^0.3.3",
74
- "@langchain/google-genai": "^0.1.0",
75
- "@langchain/mistralai": "^0.1.1",
76
- "@langchain/openai": "^0.3.0",
77
- "ansi-styles": "^6.2.1",
78
- axios: "^1.7.7",
79
- camelcase: "^8.0.0",
80
- decamelize: "^6.0.0",
81
- dotenv: "^16.4.5",
82
- eventemitter3: "^5.0.1",
83
- langchain: "^0.3.2",
84
- langsmith: "^0.1.60",
85
- "p-finally": "^2.0.1",
86
- "p-queue": "^8.0.1",
87
- "p-retry": "^6.2.0",
88
- "p-timeout": "^6.1.2",
89
- retry: "^0.13.1",
90
- semver: "^7.6.3",
91
- uuid: "^10.0.0",
92
- zod: "^3.23.8",
93
- "zod-to-json-schema": "^3.23.3"
94
- };
95
- const devDependencies = {
96
- "@semantic-release/changelog": "^6.0.3",
97
- "@semantic-release/commit-analyzer": "^12.0.0",
98
- "@semantic-release/git": "^10.0.1",
99
- "@semantic-release/github": "^10.0.0",
100
- "@semantic-release/npm": "^12.0.0",
101
- "@semantic-release/release-notes-generator": "^13.0.0",
102
- "@swc/cli": "0.3.12",
103
- "@swc/core": "1.5.7",
104
- "@swc/jest": "0.2.36",
105
- "@types/jest": "29.5.12",
106
- "@types/node": "20.12.12",
107
- "@typescript-eslint/eslint-plugin": "7.9.0",
108
- "@typescript-eslint/parser": "7.9.0",
109
- eslint: "8.57.0",
110
- "eslint-config-prettier": "9.1.0",
111
- "eslint-plugin-jest": "27.9.0",
112
- "eslint-plugin-prettier": "5.1.3",
113
- husky: "^9.0.0",
114
- jest: "29.7.0",
115
- "lint-staged": "^15.0.0",
116
- nodemon: "3.1.0",
117
- prettier: "3.2.5",
118
- "regenerator-runtime": "^0.14.0",
119
- rimraf: "5.0.7",
120
- "semantic-release": "^23.0.0",
121
- "ts-node": "^10.9.1",
122
- typescript: "5.4.5",
123
- unbuild: "^2.0.0"
124
- };
125
- const resolutions = {
126
- "wrap-ansi": "7.0.0"
127
- };
128
- const engines = {
129
- node: ">=20",
130
- npm: ">=8"
131
- };
12
+ const version = "1.1.1";
132
13
  const packageJson = {
133
- name: name,
134
- type: type,
135
- version: version,
136
- author: author,
137
- license: license,
138
- description: description,
139
- main: main,
140
- exports: exports,
141
- types: types,
142
- repository: repository,
143
- bugs: bugs,
144
- homepage: homepage,
145
- files: files,
146
- keywords: keywords,
147
- scripts: scripts,
148
- dependencies: dependencies,
149
- devDependencies: devDependencies,
150
- resolutions: resolutions,
151
- engines: engines
152
- };
14
+ version: version};
153
15
 
154
- var __defProp$1 = Object.defineProperty;
155
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
156
- var __publicField$1 = (obj, key, value) => {
157
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
158
- return value;
159
- };
160
16
  class ChatPerplexity extends BaseChatModel {
161
- constructor({ apiKey, model }) {
162
- super({});
163
- __publicField$1(this, "apiKey");
164
- __publicField$1(this, "model");
165
- this.apiKey = apiKey;
166
- this.model = model;
167
- }
168
17
  _generate(messages, options, runManager) {
169
18
  throw new Error(
170
19
  "Method not implemented." + JSON.stringify(messages) + JSON.stringify(options) + JSON.stringify(runManager)
171
20
  );
172
21
  }
22
+ apiKey;
23
+ model;
24
+ constructor({ apiKey, model }) {
25
+ super({});
26
+ this.apiKey = apiKey;
27
+ this.model = model;
28
+ }
173
29
  _llmType() {
174
30
  return "perplexity";
175
31
  }
@@ -229,6 +85,8 @@ const SupportedModel = {
229
85
  GPT_4O_MINI_2024_07_18: "gpt-4o-mini-2024-07-18",
230
86
  GPT_4O_MINI: "gpt-4o-mini",
231
87
  GPT_4_0125_PREVIEW: "gpt-4-0125-preview",
88
+ GPT_4_5_PREVIEW: "gpt-4.5-preview",
89
+ GPT_4_5_PREVIEW_2025_02_27: "gpt-4.5-preview-2025-02-27",
232
90
  CHATGPT_4O_LATEST: "chatgpt-4o-latest",
233
91
  O1_PREVIEW: "o1-preview",
234
92
  O1_PREVIEW_2024_09_12: "o1-preview-2024-09-12",
@@ -242,11 +100,15 @@ const SupportedModel = {
242
100
  CLAUDE_3_5_SONNET_LATEST: "claude-3-5-sonnet-latest",
243
101
  CLAUDE_3_HAIKU_20240307: "claude-3-haiku-20240307",
244
102
  CLAUDE_3_5_HAIKU_20241022: "claude-3-5-haiku-20241022",
103
+ CLAUDE_3_7_SONNET_LATEST: "claude-3-7-sonnet-latest",
104
+ CLAUDE_3_7_SONNET_20250219: "claude-3-7-sonnet-20250219",
245
105
  GEMINI_PRO: "gemini-pro",
246
106
  GEMINI_1_PRO_LATEST: "gemini-1.0-pro-latest",
247
107
  GEMINI_15_PRO_LATEST: "gemini-1.5-pro-latest",
248
108
  GEMINI_15_PRO_EXP_0801: "gemini-1.5-pro-exp-0801",
249
109
  GEMINI_15_FLASH_LATEST: "gemini-1.5-flash-latest",
110
+ GEMINI_2_0_FLASH: "gemini-2.0-flash",
111
+ GEMINI_2_0_FLASH_001: "gemini-2.0-flash-001",
250
112
  COMMAND_R: "command-r",
251
113
  COMMAND_R_PLUS: "command-r-plus",
252
114
  MISTRAL_LARGE_LATEST: "mistral-large-latest",
@@ -291,7 +153,9 @@ const SupportedModel = {
291
153
  SupportedModel.O1_PREVIEW_2024_09_12,
292
154
  SupportedModel.O1_MINI,
293
155
  SupportedModel.O1_MINI_2024_09_12,
294
- SupportedModel.CHATGPT_4O_LATEST
156
+ SupportedModel.CHATGPT_4O_LATEST,
157
+ SupportedModel.GPT_4_5_PREVIEW,
158
+ SupportedModel.GPT_4_5_PREVIEW_2025_02_27
295
159
  ],
296
160
  [SupportedProvider.ANTHROPIC]: [
297
161
  SupportedModel.CLAUDE_2_1,
@@ -301,14 +165,18 @@ const SupportedModel = {
301
165
  SupportedModel.CLAUDE_3_5_SONNET_20241022,
302
166
  SupportedModel.CLAUDE_3_5_SONNET_LATEST,
303
167
  SupportedModel.CLAUDE_3_HAIKU_20240307,
304
- SupportedModel.CLAUDE_3_5_HAIKU_20241022
168
+ SupportedModel.CLAUDE_3_5_HAIKU_20241022,
169
+ SupportedModel.CLAUDE_3_7_SONNET_LATEST,
170
+ SupportedModel.CLAUDE_3_7_SONNET_20250219
305
171
  ],
306
172
  [SupportedProvider.GOOGLE]: [
307
173
  SupportedModel.GEMINI_PRO,
308
174
  SupportedModel.GEMINI_1_PRO_LATEST,
309
175
  SupportedModel.GEMINI_15_PRO_LATEST,
310
176
  SupportedModel.GEMINI_15_PRO_EXP_0801,
311
- SupportedModel.GEMINI_15_FLASH_LATEST
177
+ SupportedModel.GEMINI_15_FLASH_LATEST,
178
+ SupportedModel.GEMINI_2_0_FLASH,
179
+ SupportedModel.GEMINI_2_0_FLASH_001
312
180
  ],
313
181
  [SupportedProvider.MISTRAL]: [
314
182
  SupportedModel.MISTRAL_LARGE_LATEST,
@@ -489,24 +357,18 @@ function extractContent(response) {
489
357
  return typeof response === "string" ? response : JSON.stringify(response);
490
358
  }
491
359
 
492
- var __defProp = Object.defineProperty;
493
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
494
- var __publicField = (obj, key, value) => {
495
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
496
- return value;
497
- };
498
360
  const SDK_VERSION = packageJson.version;
499
361
  dotenv.config();
500
362
  const DEFAULT_TIMEOUT = 5;
501
363
  const BASE_URL = "https://api.notdiamond.ai";
502
364
  class NotDiamond {
365
+ apiKey;
366
+ apiUrl;
367
+ modelSelectUrl;
368
+ feedbackUrl;
369
+ createUrl;
370
+ llmKeys;
503
371
  constructor(options = {}) {
504
- __publicField(this, "apiKey");
505
- __publicField(this, "apiUrl");
506
- __publicField(this, "modelSelectUrl");
507
- __publicField(this, "feedbackUrl");
508
- __publicField(this, "createUrl");
509
- __publicField(this, "llmKeys");
510
372
  this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
511
373
  this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
512
374
  this.llmKeys = options.llmKeys || {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "notdiamond",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "author": "not-diamond",
6
6
  "license": "MIT",
7
7
  "description": "TS/JS client for the NotDiamond API",
@@ -65,7 +65,7 @@
65
65
  "@langchain/mistralai": "^0.1.1",
66
66
  "@langchain/openai": "^0.3.0",
67
67
  "ansi-styles": "^6.2.1",
68
- "axios": "^1.7.7",
68
+ "axios": "^1.8.3",
69
69
  "camelcase": "^8.0.0",
70
70
  "decamelize": "^6.0.0",
71
71
  "dotenv": "^16.4.5",
@@ -84,14 +84,14 @@
84
84
  },
85
85
  "devDependencies": {
86
86
  "@semantic-release/changelog": "^6.0.3",
87
- "@semantic-release/commit-analyzer": "^12.0.0",
87
+ "@semantic-release/commit-analyzer": "^13.0.1",
88
88
  "@semantic-release/git": "^10.0.1",
89
- "@semantic-release/github": "^10.0.0",
90
- "@semantic-release/npm": "^12.0.0",
91
- "@semantic-release/release-notes-generator": "^13.0.0",
92
- "@swc/cli": "0.3.12",
93
- "@swc/core": "1.5.7",
94
- "@swc/jest": "0.2.36",
89
+ "@semantic-release/github": "^11.0.1",
90
+ "@semantic-release/npm": "^12.0.1",
91
+ "@semantic-release/release-notes-generator": "^14.0.3",
92
+ "@swc/cli": "^0.6.0",
93
+ "@swc/core": "^1.11.10",
94
+ "@swc/jest": "^0.2.37",
95
95
  "@types/jest": "29.5.12",
96
96
  "@types/node": "20.12.12",
97
97
  "@typescript-eslint/eslint-plugin": "7.9.0",
@@ -101,19 +101,26 @@
101
101
  "eslint-plugin-jest": "27.9.0",
102
102
  "eslint-plugin-prettier": "5.1.3",
103
103
  "husky": "^9.0.0",
104
- "jest": "29.7.0",
104
+ "jest": "^29.7.0",
105
105
  "lint-staged": "^15.0.0",
106
106
  "nodemon": "3.1.0",
107
107
  "prettier": "3.2.5",
108
108
  "regenerator-runtime": "^0.14.0",
109
109
  "rimraf": "5.0.7",
110
- "semantic-release": "^23.0.0",
110
+ "semantic-release": "^24.2.3",
111
111
  "ts-node": "^10.9.1",
112
112
  "typescript": "5.4.5",
113
- "unbuild": "^2.0.0"
113
+ "unbuild": "^3.5.0"
114
114
  },
115
115
  "resolutions": {
116
- "wrap-ansi": "7.0.0"
116
+ "wrap-ansi": "7.0.0",
117
+ "cross-spawn": "^7.0.5",
118
+ "@octokit/request-error": "^6.1.7",
119
+ "@octokit/endpoint": "^10.1.3",
120
+ "@octokit/request": "^9.2.1",
121
+ "@octokit/plugin-paginate-rest": "^11.4.1",
122
+ "@babel/helpers": "^7.26.10",
123
+ "esbuild": "^0.25.0"
117
124
  },
118
125
  "engines": {
119
126
  "node": ">=20",