@node-llm/core 1.16.1 → 1.16.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/aliases.d.ts +187 -209
- package/dist/aliases.d.ts.map +1 -1
- package/dist/aliases.js +257 -279
- package/dist/models/models.json +4205 -10463
- package/dist/providers/gemini/Chat.d.ts.map +1 -1
- package/dist/providers/gemini/Chat.js +1 -1
- package/dist/providers/gemini/Streaming.js +1 -1
- package/dist/providers/gemini/types.d.ts +1 -1
- package/dist/providers/gemini/types.d.ts.map +1 -1
- package/dist/transcription/Transcription.d.ts.map +1 -1
- package/package.json +10 -13
- package/dist/aliases.json +0 -132
- package/dist/interceptors/InterceptorChain.d.ts +0 -47
- package/dist/interceptors/InterceptorChain.d.ts.map +0 -1
- package/dist/interceptors/InterceptorChain.js +0 -63
- package/dist/interceptors/examples.d.ts +0 -19
- package/dist/interceptors/examples.d.ts.map +0 -1
- package/dist/interceptors/examples.js +0 -38
- package/dist/models/models.d.ts +0 -572
- package/dist/models/models.d.ts.map +0 -1
- package/dist/models/models.js +0 -15963
- package/dist/models/pricing.json +0 -87
- package/dist/utils/ThinkingNormalizer.d.ts +0 -16
- package/dist/utils/ThinkingNormalizer.d.ts.map +0 -1
- package/dist/utils/ThinkingNormalizer.js +0 -30
- package/dist/utils/sanitize.d.ts +0 -21
- package/dist/utils/sanitize.d.ts.map +0 -1
- package/dist/utils/sanitize.js +0 -76
package/dist/models/pricing.json
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "1.0.0",
|
|
3
|
-
"models": {
|
|
4
|
-
"openai/gpt-4o": {
|
|
5
|
-
"text_tokens": {
|
|
6
|
-
"standard": { "input_per_million": 2.5, "output_per_million": 10.0 }
|
|
7
|
-
}
|
|
8
|
-
},
|
|
9
|
-
"openai/gpt-4o-mini": {
|
|
10
|
-
"text_tokens": {
|
|
11
|
-
"standard": { "input_per_million": 0.15, "output_per_million": 0.6 }
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"anthropic/claude-3-5-sonnet-latest": {
|
|
15
|
-
"text_tokens": {
|
|
16
|
-
"standard": { "input_per_million": 3.0, "output_per_million": 15.0 }
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"deepseek/deepseek-chat": {
|
|
20
|
-
"text_tokens": {
|
|
21
|
-
"standard": { "input_per_million": 0.014, "output_per_million": 0.28 }
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"deepseek/deepseek-reasoner": {
|
|
25
|
-
"text_tokens": {
|
|
26
|
-
"standard": { "input_per_million": 0.14, "output_per_million": 2.19 }
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"patterns": [
|
|
31
|
-
{
|
|
32
|
-
"provider": "openai",
|
|
33
|
-
"pattern": "gpt-3",
|
|
34
|
-
"pricing": {
|
|
35
|
-
"text_tokens": {
|
|
36
|
-
"standard": { "input_per_million": 0.5, "output_per_million": 1.5 }
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"provider": "openai",
|
|
42
|
-
"pattern": "mini",
|
|
43
|
-
"pricing": {
|
|
44
|
-
"text_tokens": {
|
|
45
|
-
"standard": { "input_per_million": 0.15, "output_per_million": 0.6 }
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"provider": "anthropic",
|
|
51
|
-
"pattern": "claude-3",
|
|
52
|
-
"pricing": {
|
|
53
|
-
"text_tokens": {
|
|
54
|
-
"standard": { "input_per_million": 3.0, "output_per_million": 15.0 },
|
|
55
|
-
"batch": { "input_per_million": 1.5, "output_per_million": 7.5 }
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"provider": "gemini",
|
|
61
|
-
"pattern": "gemini-1\\.5-flash",
|
|
62
|
-
"pricing": {
|
|
63
|
-
"text_tokens": {
|
|
64
|
-
"standard": { "input_per_million": 0.075, "output_per_million": 0.3 }
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"provider": "gemini",
|
|
70
|
-
"pattern": "gemini-1\\.5-pro",
|
|
71
|
-
"pricing": {
|
|
72
|
-
"text_tokens": {
|
|
73
|
-
"standard": { "input_per_million": 3.5, "output_per_million": 10.5 }
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"provider": "gemini",
|
|
79
|
-
"pattern": "gemini-2\\.0-flash",
|
|
80
|
-
"pricing": {
|
|
81
|
-
"text_tokens": {
|
|
82
|
-
"standard": { "input_per_million": 0.1, "output_per_million": 0.4 }
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility to extract <think> tags from text content and normalize them
|
|
3
|
-
* into structured thinking metadata. This is used for models like
|
|
4
|
-
* DeepSeek R1 or Sonar that return thinking traces within the main text.
|
|
5
|
-
*/
|
|
6
|
-
export declare class ThinkingNormalizer {
|
|
7
|
-
/**
|
|
8
|
-
* Extracts <think>...</think> blocks from content.
|
|
9
|
-
* Returns the cleaned content and the extracted thinking text.
|
|
10
|
-
*/
|
|
11
|
-
static normalize(content: string): {
|
|
12
|
-
content: string;
|
|
13
|
-
thinking?: string;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=ThinkingNormalizer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThinkingNormalizer.d.ts","sourceRoot":"","sources":["../../src/utils/ThinkingNormalizer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,kBAAkB;IAC7B;;;OAGG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE;CAuB1E"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility to extract <think> tags from text content and normalize them
|
|
3
|
-
* into structured thinking metadata. This is used for models like
|
|
4
|
-
* DeepSeek R1 or Sonar that return thinking traces within the main text.
|
|
5
|
-
*/
|
|
6
|
-
export class ThinkingNormalizer {
|
|
7
|
-
/**
|
|
8
|
-
* Extracts <think>...</think> blocks from content.
|
|
9
|
-
* Returns the cleaned content and the extracted thinking text.
|
|
10
|
-
*/
|
|
11
|
-
static normalize(content) {
|
|
12
|
-
if (!content.includes("<think>")) {
|
|
13
|
-
return { content };
|
|
14
|
-
}
|
|
15
|
-
// Capture everything between <think> and </think> (case-insensitive, multi-line)
|
|
16
|
-
const regex = /<think>([\s\S]*?)<\/think>/gi;
|
|
17
|
-
let thinking = "";
|
|
18
|
-
let cleanContent = content;
|
|
19
|
-
const matches = content.matchAll(regex);
|
|
20
|
-
for (const match of matches) {
|
|
21
|
-
thinking += (thinking ? "\n\n" : "") + match[1].trim();
|
|
22
|
-
}
|
|
23
|
-
// Remove all <think> blocks from the content
|
|
24
|
-
cleanContent = content.replace(regex, "").trim();
|
|
25
|
-
return {
|
|
26
|
-
content: cleanContent,
|
|
27
|
-
thinking: thinking || undefined
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
package/dist/utils/sanitize.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for sanitizing sensitive data from error messages and objects
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Sanitizes API keys and other sensitive data from strings
|
|
6
|
-
* @param text - The text to sanitize
|
|
7
|
-
* @returns Sanitized text with sensitive data redacted
|
|
8
|
-
*/
|
|
9
|
-
export declare function sanitizeText(text: string): string;
|
|
10
|
-
/**
|
|
11
|
-
* Sanitizes an error object by redacting sensitive data
|
|
12
|
-
* @param error - The error object to sanitize
|
|
13
|
-
* @returns Sanitized error object
|
|
14
|
-
*/
|
|
15
|
-
export declare function sanitizeError(error: any): any;
|
|
16
|
-
/**
|
|
17
|
-
* Logs an error with sanitized output
|
|
18
|
-
* @param error - The error to log
|
|
19
|
-
*/
|
|
20
|
-
export declare function logSanitizedError(error: any): void;
|
|
21
|
-
//# sourceMappingURL=sanitize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../src/utils/sanitize.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAiCjD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CA+B7C;AAiBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,GAAG,IAAI,CAGlD"}
|
package/dist/utils/sanitize.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for sanitizing sensitive data from error messages and objects
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Sanitizes API keys and other sensitive data from strings
|
|
6
|
-
* @param text - The text to sanitize
|
|
7
|
-
* @returns Sanitized text with sensitive data redacted
|
|
8
|
-
*/
|
|
9
|
-
export function sanitizeText(text) {
|
|
10
|
-
if (!text)
|
|
11
|
-
return text;
|
|
12
|
-
// Sanitize API keys (various formats)
|
|
13
|
-
// OpenAI: sk-...
|
|
14
|
-
// Anthropic: sk-ant-...
|
|
15
|
-
// Generic patterns
|
|
16
|
-
let sanitized = text;
|
|
17
|
-
// Pattern: sk-ant-api03-... or sk-...
|
|
18
|
-
sanitized = sanitized.replace(/sk-ant-[a-zA-Z0-9_-]{8,}/g, (match) => `sk-ant-***${match.slice(-4)}`);
|
|
19
|
-
sanitized = sanitized.replace(/sk-[a-zA-Z0-9_-]{20,}/g, (match) => `sk-***${match.slice(-4)}`);
|
|
20
|
-
// Pattern: Bearer tokens
|
|
21
|
-
sanitized = sanitized.replace(/Bearer\s+[a-zA-Z0-9_-]{20,}/gi, (match) => `Bearer ***${match.slice(-4)}`);
|
|
22
|
-
// Pattern: API keys in error messages like "Incorrect API key provided: 8TAXX2TT***..."
|
|
23
|
-
sanitized = sanitized.replace(/API key[^:]*:\s*[a-zA-Z0-9]{4,}\**/gi, 'API key: [REDACTED]');
|
|
24
|
-
return sanitized;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Sanitizes an error object by redacting sensitive data
|
|
28
|
-
* @param error - The error object to sanitize
|
|
29
|
-
* @returns Sanitized error object
|
|
30
|
-
*/
|
|
31
|
-
export function sanitizeError(error) {
|
|
32
|
-
if (!error)
|
|
33
|
-
return error;
|
|
34
|
-
// Handle Error instances
|
|
35
|
-
if (error instanceof Error) {
|
|
36
|
-
const sanitized = new Error(sanitizeText(error.message));
|
|
37
|
-
sanitized.name = error.name;
|
|
38
|
-
sanitized.stack = error.stack ? sanitizeText(error.stack) : undefined;
|
|
39
|
-
// Copy other properties
|
|
40
|
-
Object.keys(error).forEach(key => {
|
|
41
|
-
if (key !== 'message' && key !== 'stack' && key !== 'name') {
|
|
42
|
-
sanitized[key] = sanitizeErrorValue(error[key]);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return sanitized;
|
|
46
|
-
}
|
|
47
|
-
// Handle plain objects
|
|
48
|
-
if (typeof error === 'object') {
|
|
49
|
-
const sanitized = Array.isArray(error) ? [] : {};
|
|
50
|
-
for (const key in error) {
|
|
51
|
-
sanitized[key] = sanitizeErrorValue(error[key]);
|
|
52
|
-
}
|
|
53
|
-
return sanitized;
|
|
54
|
-
}
|
|
55
|
-
return error;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Sanitizes a single value (recursive helper)
|
|
59
|
-
*/
|
|
60
|
-
function sanitizeErrorValue(value) {
|
|
61
|
-
if (typeof value === 'string') {
|
|
62
|
-
return sanitizeText(value);
|
|
63
|
-
}
|
|
64
|
-
if (typeof value === 'object' && value !== null) {
|
|
65
|
-
return sanitizeError(value);
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Logs an error with sanitized output
|
|
71
|
-
* @param error - The error to log
|
|
72
|
-
*/
|
|
73
|
-
export function logSanitizedError(error) {
|
|
74
|
-
const sanitized = sanitizeError(error);
|
|
75
|
-
console.error('[NodeLLM Error]', sanitized);
|
|
76
|
-
}
|