@juspay/neurolink 9.86.1 → 9.86.3
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/CHANGELOG.md +12 -0
- package/README.md +18 -11
- package/dist/browser/neurolink.min.js +351 -351
- package/dist/lib/providers/anthropic.js +52 -3
- package/dist/lib/providers/openaiChatCompletionsClient.d.ts +3 -11
- package/dist/lib/types/common.d.ts +17 -0
- package/dist/lib/utils/anthropicCacheBreakpoints.d.ts +29 -1
- package/dist/lib/utils/anthropicCacheBreakpoints.js +54 -1
- package/dist/lib/utils/tokenUtils.d.ts +7 -2
- package/dist/lib/utils/tokenUtils.js +19 -2
- package/dist/providers/anthropic.js +52 -3
- package/dist/providers/openaiChatCompletionsClient.d.ts +3 -11
- package/dist/types/common.d.ts +17 -0
- package/dist/utils/anthropicCacheBreakpoints.d.ts +29 -1
- package/dist/utils/anthropicCacheBreakpoints.js +54 -1
- package/dist/utils/tokenUtils.d.ts +7 -2
- package/dist/utils/tokenUtils.js +19 -2
- package/package.json +4 -3
package/dist/utils/tokenUtils.js
CHANGED
|
@@ -74,7 +74,9 @@ export function extractReasoningTokens(usage) {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Extract cache creation token count from various provider formats
|
|
77
|
-
* Supports: cacheCreationInputTokens, cacheCreationTokens
|
|
77
|
+
* Supports: cacheCreationInputTokens, cacheCreationTokens, and the ai@6
|
|
78
|
+
* normalized `inputTokenDetails.cacheWriteTokens` (the only shape the native
|
|
79
|
+
* direct-Anthropic path reports through generateText).
|
|
78
80
|
*/
|
|
79
81
|
export function extractCacheCreationTokens(usage) {
|
|
80
82
|
if (typeof usage.cacheCreationInputTokens === "number" &&
|
|
@@ -85,11 +87,18 @@ export function extractCacheCreationTokens(usage) {
|
|
|
85
87
|
usage.cacheCreationTokens > 0) {
|
|
86
88
|
return usage.cacheCreationTokens;
|
|
87
89
|
}
|
|
90
|
+
if (typeof usage.inputTokenDetails?.cacheWriteTokens === "number" &&
|
|
91
|
+
usage.inputTokenDetails.cacheWriteTokens > 0) {
|
|
92
|
+
return usage.inputTokenDetails.cacheWriteTokens;
|
|
93
|
+
}
|
|
88
94
|
return undefined;
|
|
89
95
|
}
|
|
90
96
|
/**
|
|
91
97
|
* Extract cache read token count from various provider formats
|
|
92
|
-
* Supports: cacheReadInputTokens, cacheReadTokens
|
|
98
|
+
* Supports: cacheReadInputTokens, cacheReadTokens, and the ai@6 normalized
|
|
99
|
+
* shapes — flat `cachedInputTokens` and nested
|
|
100
|
+
* `inputTokenDetails.cacheReadTokens` (the only shapes the native
|
|
101
|
+
* direct-Anthropic path reports through generateText).
|
|
93
102
|
*/
|
|
94
103
|
export function extractCacheReadTokens(usage) {
|
|
95
104
|
if (typeof usage.cacheReadInputTokens === "number" &&
|
|
@@ -99,6 +108,14 @@ export function extractCacheReadTokens(usage) {
|
|
|
99
108
|
if (typeof usage.cacheReadTokens === "number" && usage.cacheReadTokens > 0) {
|
|
100
109
|
return usage.cacheReadTokens;
|
|
101
110
|
}
|
|
111
|
+
if (typeof usage.cachedInputTokens === "number" &&
|
|
112
|
+
usage.cachedInputTokens > 0) {
|
|
113
|
+
return usage.cachedInputTokens;
|
|
114
|
+
}
|
|
115
|
+
if (typeof usage.inputTokenDetails?.cacheReadTokens === "number" &&
|
|
116
|
+
usage.inputTokenDetails.cacheReadTokens > 0) {
|
|
117
|
+
return usage.inputTokenDetails.cacheReadTokens;
|
|
118
|
+
}
|
|
102
119
|
return undefined;
|
|
103
120
|
}
|
|
104
121
|
/**
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.86.
|
|
3
|
+
"version": "9.86.3",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (58+ servers), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Juspay Technologies",
|
|
8
8
|
"email": "support@juspay.in",
|
|
@@ -359,10 +359,12 @@
|
|
|
359
359
|
"csv-parser": "^3.2.0",
|
|
360
360
|
"dotenv": "^17.3.1",
|
|
361
361
|
"eventsource-parser": "^3.0.8",
|
|
362
|
+
"fast-xml-parser": "^5.7.0",
|
|
362
363
|
"google-auth-library": "^10.6.1",
|
|
363
364
|
"hono": "^4.12.21",
|
|
364
365
|
"inquirer": "^13.3.0",
|
|
365
366
|
"jose": "^6.1.3",
|
|
367
|
+
"js-yaml": "^4.2.0",
|
|
366
368
|
"json-schema-to-zod": "^2.7.0",
|
|
367
369
|
"jsonrepair": "^3.14.0",
|
|
368
370
|
"nanoid": "^5.1.5",
|
|
@@ -478,7 +480,6 @@
|
|
|
478
480
|
"esbuild": "^0.28.1",
|
|
479
481
|
"eslint": "^10.0.2",
|
|
480
482
|
"husky": "^9.1.7",
|
|
481
|
-
"js-yaml": "^4.2.0",
|
|
482
483
|
"lint-staged": "^16.3.0",
|
|
483
484
|
"playwright": "^1.58.2",
|
|
484
485
|
"prettier": "^3.8.1",
|