notdiamond 1.0.10 → 1.1.1
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 +17 -167
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +17 -167
- package/package.json +20 -13
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
|
|
32
|
-
const type = "module";
|
|
33
|
-
const version = "1.0.9";
|
|
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.0";
|
|
151
32
|
const packageJson = {
|
|
152
|
-
|
|
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
|
}
|
|
@@ -286,7 +142,7 @@ const SupportedModel = {
|
|
|
286
142
|
LLAMA_3_1_8B_INSTRUCT_TURBO: "Meta-Llama-3.1-8B-Instruct-Turbo",
|
|
287
143
|
LLAMA_3_1_70B_INSTRUCT_TURBO: "Meta-Llama-3.1-70B-Instruct-Turbo",
|
|
288
144
|
LLAMA_3_1_405B_INSTRUCT_TURBO: "Meta-Llama-3.1-405B-Instruct-Turbo",
|
|
289
|
-
|
|
145
|
+
PERPLEXITY_SONAR: "sonar",
|
|
290
146
|
OPEN_MISTRAL_NEMO: "open-mistral-nemo",
|
|
291
147
|
DEEPSEEK_R1: "DeepSeek-R1"
|
|
292
148
|
};
|
|
@@ -342,7 +198,7 @@ const SupportedModel = {
|
|
|
342
198
|
SupportedModel.OPEN_MISTRAL_NEMO
|
|
343
199
|
],
|
|
344
200
|
[SupportedProvider.PERPLEXITY]: [
|
|
345
|
-
SupportedModel.
|
|
201
|
+
SupportedModel.PERPLEXITY_SONAR
|
|
346
202
|
],
|
|
347
203
|
[SupportedProvider.COHERE]: [
|
|
348
204
|
SupportedModel.COMMAND_R,
|
|
@@ -508,24 +364,18 @@ function extractContent(response) {
|
|
|
508
364
|
return typeof response === "string" ? response : JSON.stringify(response);
|
|
509
365
|
}
|
|
510
366
|
|
|
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
367
|
const SDK_VERSION = packageJson.version;
|
|
518
368
|
dotenv__namespace.config();
|
|
519
369
|
const DEFAULT_TIMEOUT = 5;
|
|
520
370
|
const BASE_URL = "https://api.notdiamond.ai";
|
|
521
371
|
class NotDiamond {
|
|
372
|
+
apiKey;
|
|
373
|
+
apiUrl;
|
|
374
|
+
modelSelectUrl;
|
|
375
|
+
feedbackUrl;
|
|
376
|
+
createUrl;
|
|
377
|
+
llmKeys;
|
|
522
378
|
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
379
|
this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
|
|
530
380
|
this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
|
|
531
381
|
this.llmKeys = options.llmKeys || {};
|
package/dist/index.d.cts
CHANGED
|
@@ -62,7 +62,7 @@ declare const SupportedModel: {
|
|
|
62
62
|
readonly LLAMA_3_1_8B_INSTRUCT_TURBO: "Meta-Llama-3.1-8B-Instruct-Turbo";
|
|
63
63
|
readonly LLAMA_3_1_70B_INSTRUCT_TURBO: "Meta-Llama-3.1-70B-Instruct-Turbo";
|
|
64
64
|
readonly LLAMA_3_1_405B_INSTRUCT_TURBO: "Meta-Llama-3.1-405B-Instruct-Turbo";
|
|
65
|
-
readonly
|
|
65
|
+
readonly PERPLEXITY_SONAR: "sonar";
|
|
66
66
|
readonly OPEN_MISTRAL_NEMO: "open-mistral-nemo";
|
|
67
67
|
readonly DEEPSEEK_R1: "DeepSeek-R1";
|
|
68
68
|
};
|
|
@@ -71,7 +71,7 @@ declare const ProviderModelMap: {
|
|
|
71
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
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"];
|
|
73
73
|
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
|
-
readonly perplexity: readonly ["
|
|
74
|
+
readonly perplexity: readonly ["sonar"];
|
|
75
75
|
readonly cohere: readonly ["command-r", "command-r-plus"];
|
|
76
76
|
readonly togetherai: readonly ["Mistral-7B-Instruct-v0.2", "Mixtral-8x7B-Instruct-v0.1", "Mixtral-8x22B-Instruct-v0.1", "Llama-3-70b-chat-hf", "Llama-3-8b-chat-hf", "Qwen2-72B-Instruct", "Meta-Llama-3.1-8B-Instruct-Turbo", "Meta-Llama-3.1-70B-Instruct-Turbo", "Meta-Llama-3.1-405B-Instruct-Turbo", "DeepSeek-R1"];
|
|
77
77
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -62,7 +62,7 @@ declare const SupportedModel: {
|
|
|
62
62
|
readonly LLAMA_3_1_8B_INSTRUCT_TURBO: "Meta-Llama-3.1-8B-Instruct-Turbo";
|
|
63
63
|
readonly LLAMA_3_1_70B_INSTRUCT_TURBO: "Meta-Llama-3.1-70B-Instruct-Turbo";
|
|
64
64
|
readonly LLAMA_3_1_405B_INSTRUCT_TURBO: "Meta-Llama-3.1-405B-Instruct-Turbo";
|
|
65
|
-
readonly
|
|
65
|
+
readonly PERPLEXITY_SONAR: "sonar";
|
|
66
66
|
readonly OPEN_MISTRAL_NEMO: "open-mistral-nemo";
|
|
67
67
|
readonly DEEPSEEK_R1: "DeepSeek-R1";
|
|
68
68
|
};
|
|
@@ -71,7 +71,7 @@ declare const ProviderModelMap: {
|
|
|
71
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
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"];
|
|
73
73
|
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
|
-
readonly perplexity: readonly ["
|
|
74
|
+
readonly perplexity: readonly ["sonar"];
|
|
75
75
|
readonly cohere: readonly ["command-r", "command-r-plus"];
|
|
76
76
|
readonly togetherai: readonly ["Mistral-7B-Instruct-v0.2", "Mixtral-8x7B-Instruct-v0.1", "Mixtral-8x22B-Instruct-v0.1", "Llama-3-70b-chat-hf", "Llama-3-8b-chat-hf", "Qwen2-72B-Instruct", "Meta-Llama-3.1-8B-Instruct-Turbo", "Meta-Llama-3.1-70B-Instruct-Turbo", "Meta-Llama-3.1-405B-Instruct-Turbo", "DeepSeek-R1"];
|
|
77
77
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ declare const SupportedModel: {
|
|
|
62
62
|
readonly LLAMA_3_1_8B_INSTRUCT_TURBO: "Meta-Llama-3.1-8B-Instruct-Turbo";
|
|
63
63
|
readonly LLAMA_3_1_70B_INSTRUCT_TURBO: "Meta-Llama-3.1-70B-Instruct-Turbo";
|
|
64
64
|
readonly LLAMA_3_1_405B_INSTRUCT_TURBO: "Meta-Llama-3.1-405B-Instruct-Turbo";
|
|
65
|
-
readonly
|
|
65
|
+
readonly PERPLEXITY_SONAR: "sonar";
|
|
66
66
|
readonly OPEN_MISTRAL_NEMO: "open-mistral-nemo";
|
|
67
67
|
readonly DEEPSEEK_R1: "DeepSeek-R1";
|
|
68
68
|
};
|
|
@@ -71,7 +71,7 @@ declare const ProviderModelMap: {
|
|
|
71
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
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"];
|
|
73
73
|
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
|
-
readonly perplexity: readonly ["
|
|
74
|
+
readonly perplexity: readonly ["sonar"];
|
|
75
75
|
readonly cohere: readonly ["command-r", "command-r-plus"];
|
|
76
76
|
readonly togetherai: readonly ["Mistral-7B-Instruct-v0.2", "Mixtral-8x7B-Instruct-v0.1", "Mixtral-8x22B-Instruct-v0.1", "Llama-3-70b-chat-hf", "Llama-3-8b-chat-hf", "Qwen2-72B-Instruct", "Meta-Llama-3.1-8B-Instruct-Turbo", "Meta-Llama-3.1-70B-Instruct-Turbo", "Meta-Llama-3.1-405B-Instruct-Turbo", "DeepSeek-R1"];
|
|
77
77
|
};
|
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
|
|
13
|
-
const type = "module";
|
|
14
|
-
const version = "1.0.9";
|
|
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.0";
|
|
132
13
|
const packageJson = {
|
|
133
|
-
|
|
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
|
}
|
|
@@ -267,7 +123,7 @@ const SupportedModel = {
|
|
|
267
123
|
LLAMA_3_1_8B_INSTRUCT_TURBO: "Meta-Llama-3.1-8B-Instruct-Turbo",
|
|
268
124
|
LLAMA_3_1_70B_INSTRUCT_TURBO: "Meta-Llama-3.1-70B-Instruct-Turbo",
|
|
269
125
|
LLAMA_3_1_405B_INSTRUCT_TURBO: "Meta-Llama-3.1-405B-Instruct-Turbo",
|
|
270
|
-
|
|
126
|
+
PERPLEXITY_SONAR: "sonar",
|
|
271
127
|
OPEN_MISTRAL_NEMO: "open-mistral-nemo",
|
|
272
128
|
DEEPSEEK_R1: "DeepSeek-R1"
|
|
273
129
|
};
|
|
@@ -323,7 +179,7 @@ const SupportedModel = {
|
|
|
323
179
|
SupportedModel.OPEN_MISTRAL_NEMO
|
|
324
180
|
],
|
|
325
181
|
[SupportedProvider.PERPLEXITY]: [
|
|
326
|
-
SupportedModel.
|
|
182
|
+
SupportedModel.PERPLEXITY_SONAR
|
|
327
183
|
],
|
|
328
184
|
[SupportedProvider.COHERE]: [
|
|
329
185
|
SupportedModel.COMMAND_R,
|
|
@@ -489,24 +345,18 @@ function extractContent(response) {
|
|
|
489
345
|
return typeof response === "string" ? response : JSON.stringify(response);
|
|
490
346
|
}
|
|
491
347
|
|
|
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
348
|
const SDK_VERSION = packageJson.version;
|
|
499
349
|
dotenv.config();
|
|
500
350
|
const DEFAULT_TIMEOUT = 5;
|
|
501
351
|
const BASE_URL = "https://api.notdiamond.ai";
|
|
502
352
|
class NotDiamond {
|
|
353
|
+
apiKey;
|
|
354
|
+
apiUrl;
|
|
355
|
+
modelSelectUrl;
|
|
356
|
+
feedbackUrl;
|
|
357
|
+
createUrl;
|
|
358
|
+
llmKeys;
|
|
503
359
|
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
360
|
this.apiKey = options.apiKey || process.env.NOTDIAMOND_API_KEY || "";
|
|
511
361
|
this.apiUrl = options.apiUrl || process.env.NOTDIAMOND_API_URL || BASE_URL;
|
|
512
362
|
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.
|
|
4
|
+
"version": "1.1.1",
|
|
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.
|
|
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": "^
|
|
87
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
88
88
|
"@semantic-release/git": "^10.0.1",
|
|
89
|
-
"@semantic-release/github": "^
|
|
90
|
-
"@semantic-release/npm": "^12.0.
|
|
91
|
-
"@semantic-release/release-notes-generator": "^
|
|
92
|
-
"@swc/cli": "0.
|
|
93
|
-
"@swc/core": "1.
|
|
94
|
-
"@swc/jest": "0.2.
|
|
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": "^
|
|
110
|
+
"semantic-release": "^24.2.3",
|
|
111
111
|
"ts-node": "^10.9.1",
|
|
112
112
|
"typescript": "5.4.5",
|
|
113
|
-
"unbuild": "^
|
|
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",
|