@node-llm/core 1.16.1 → 1.17.0

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.
Files changed (65) hide show
  1. package/dist/agent/Agent.d.ts +3 -0
  2. package/dist/agent/Agent.d.ts.map +1 -1
  3. package/dist/agent/Agent.js +3 -0
  4. package/dist/aliases.d.ts +220 -218
  5. package/dist/aliases.d.ts.map +1 -1
  6. package/dist/aliases.js +290 -288
  7. package/dist/chat/Chat.d.ts +16 -5
  8. package/dist/chat/Chat.d.ts.map +1 -1
  9. package/dist/chat/Chat.js +113 -78
  10. package/dist/chat/ChatOptions.d.ts +19 -0
  11. package/dist/chat/ChatOptions.d.ts.map +1 -1
  12. package/dist/chat/ChatStream.d.ts.map +1 -1
  13. package/dist/chat/ChatStream.js +69 -58
  14. package/dist/chat/ToolCallOutcome.d.ts +30 -0
  15. package/dist/chat/ToolCallOutcome.d.ts.map +1 -0
  16. package/dist/chat/ToolCallOutcome.js +43 -0
  17. package/dist/config.d.ts +11 -0
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js +9 -1
  20. package/dist/constants.d.ts +1 -0
  21. package/dist/constants.d.ts.map +1 -1
  22. package/dist/constants.js +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/llm.d.ts +1 -1
  26. package/dist/llm.d.ts.map +1 -1
  27. package/dist/models/models.json +4752 -10560
  28. package/dist/providers/bedrock/BedrockProvider.js +1 -1
  29. package/dist/providers/bedrock/Chat.js +1 -1
  30. package/dist/providers/bedrock/Embeddings.js +1 -1
  31. package/dist/providers/bedrock/Image.js +1 -1
  32. package/dist/providers/bedrock/Moderation.js +1 -1
  33. package/dist/providers/bedrock/Streaming.js +1 -1
  34. package/dist/providers/bedrock/config.d.ts +9 -1
  35. package/dist/providers/bedrock/config.d.ts.map +1 -1
  36. package/dist/providers/bedrock/config.js +4 -2
  37. package/dist/providers/bedrock/index.d.ts.map +1 -1
  38. package/dist/providers/bedrock/index.js +1 -0
  39. package/dist/providers/gemini/Chat.d.ts.map +1 -1
  40. package/dist/providers/gemini/Chat.js +1 -1
  41. package/dist/providers/gemini/Streaming.js +1 -1
  42. package/dist/providers/gemini/types.d.ts +1 -1
  43. package/dist/providers/gemini/types.d.ts.map +1 -1
  44. package/dist/transcription/Transcription.d.ts.map +1 -1
  45. package/dist/utils/handler-stacking.d.ts +31 -0
  46. package/dist/utils/handler-stacking.d.ts.map +1 -0
  47. package/dist/utils/handler-stacking.js +66 -0
  48. package/package.json +1 -1
  49. package/dist/aliases.json +0 -132
  50. package/dist/interceptors/InterceptorChain.d.ts +0 -47
  51. package/dist/interceptors/InterceptorChain.d.ts.map +0 -1
  52. package/dist/interceptors/InterceptorChain.js +0 -63
  53. package/dist/interceptors/examples.d.ts +0 -19
  54. package/dist/interceptors/examples.d.ts.map +0 -1
  55. package/dist/interceptors/examples.js +0 -38
  56. package/dist/models/models.d.ts +0 -572
  57. package/dist/models/models.d.ts.map +0 -1
  58. package/dist/models/models.js +0 -15963
  59. package/dist/models/pricing.json +0 -87
  60. package/dist/utils/ThinkingNormalizer.d.ts +0 -16
  61. package/dist/utils/ThinkingNormalizer.d.ts.map +0 -1
  62. package/dist/utils/ThinkingNormalizer.js +0 -30
  63. package/dist/utils/sanitize.d.ts +0 -21
  64. package/dist/utils/sanitize.d.ts.map +0 -1
  65. package/dist/utils/sanitize.js +0 -76
@@ -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
- }
@@ -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"}
@@ -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
- }