@molecule/api-ai-local 1.0.8 → 1.0.10
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/README.md +2 -2
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +8 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-13T19:22:13.503Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-ai-local
|
|
@@ -333,7 +333,7 @@ export function setupAiLocal(): void {
|
|
|
333
333
|
|
|
334
334
|
Peer dependencies:
|
|
335
335
|
|
|
336
|
-
- `@molecule/api-ai` ^1.0
|
|
336
|
+
- `@molecule/api-ai` ^1.6.0
|
|
337
337
|
- `@molecule/api-bond` ^1.0.1
|
|
338
338
|
- `@molecule/api-i18n` ^1.0.1
|
|
339
339
|
- `@molecule/api-secrets` ^1.0.1
|
package/dist/provider.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EACV,UAAU,EAGV,SAAS,EAET,UAAU,EAGX,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EACV,UAAU,EAGV,SAAS,EAET,UAAU,EAGX,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAgC7C;;;;GAIG;AACH,qBAAa,eAAgB,YAAW,UAAU;IAChD,QAAQ,CAAC,IAAI,WAAU;IACvB,OAAO,CAAC,MAAM,CAAQ;IACtB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,WAAW,CAAC,CAAqB;gBAE7B,MAAM,GAAE,WAAgB;IAepC;;;;;OAKG;IACI,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,aAAa,CAAC,SAAS,CAAC;IAkMzD;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,cAAc;IA+DtB;;;;OAIG;IACH,OAAO,CAAC,WAAW;IA6BnB,uEAAuE;IACvE,OAAO,CAAC,WAAW;IAWnB;;;;;OAKG;IACH,OAAO,CAAE,yBAAyB;IAiDlC;;;;;OAKG;YACY,sBAAsB;IAkFrC;;;;;;OAMG;IACH,OAAO,CAAE,eAAe;IAsGxB;;;;;;;;;;OAUG;IACH,OAAO,CAAE,qBAAqB;CAqC/B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,CAE/D"}
|
package/dist/provider.js
CHANGED
|
@@ -387,6 +387,7 @@ export class LocalAIProvider {
|
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
389
|
const usage = data.usage;
|
|
390
|
+
const reasoning = usage?.completion_tokens_details?.reasoning_tokens;
|
|
390
391
|
const cached = usage?.prompt_tokens_details?.cached_tokens ?? 0;
|
|
391
392
|
yield {
|
|
392
393
|
type: 'done',
|
|
@@ -395,6 +396,7 @@ export class LocalAIProvider {
|
|
|
395
396
|
// consumer's context/cost math doesn't double-count the cached subset.
|
|
396
397
|
inputTokens: Math.max(0, (usage?.prompt_tokens ?? 0) - cached),
|
|
397
398
|
outputTokens: usage?.completion_tokens ?? 0,
|
|
399
|
+
...(typeof reasoning === 'number' ? { reasoningOutputTokens: reasoning } : {}),
|
|
398
400
|
cacheReadInputTokens: cached,
|
|
399
401
|
},
|
|
400
402
|
};
|
|
@@ -477,6 +479,9 @@ export class LocalAIProvider {
|
|
|
477
479
|
usage: {
|
|
478
480
|
inputTokens: Math.max(0, state.inputTokens - state.cachedTokens),
|
|
479
481
|
outputTokens: state.outputTokens,
|
|
482
|
+
...(state.reasoningOutputTokens !== undefined
|
|
483
|
+
? { reasoningOutputTokens: state.reasoningOutputTokens }
|
|
484
|
+
: {}),
|
|
480
485
|
cacheReadInputTokens: state.cachedTokens,
|
|
481
486
|
},
|
|
482
487
|
provider: call.meta,
|
|
@@ -565,6 +570,9 @@ export class LocalAIProvider {
|
|
|
565
570
|
}
|
|
566
571
|
const usage = event.usage;
|
|
567
572
|
if (usage) {
|
|
573
|
+
const reasoning = usage.completion_tokens_details?.reasoning_tokens;
|
|
574
|
+
if (typeof reasoning === 'number')
|
|
575
|
+
state.reasoningOutputTokens = reasoning;
|
|
568
576
|
if (typeof usage.prompt_tokens === 'number')
|
|
569
577
|
state.inputTokens = usage.prompt_tokens;
|
|
570
578
|
if (typeof usage.completion_tokens === 'number')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-ai-local",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "AIProvider bond for any OpenAI-compatible local inference server (Ollama, LM Studio, llama.cpp, vLLM) — configurable base URL, keyless by default, streamed via
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "AIProvider bond for any OpenAI-compatible local inference server (Ollama, LM Studio, llama.cpp, vLLM) — configurable base URL, keyless by default, streamed via fetch",
|
|
5
5
|
"homepage": "https://www.molecule.dev/packages/api-ai-local",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"directory": "packages/api/bonds/ai/local"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@molecule/api-ai": "1.
|
|
36
|
+
"@molecule/api-ai": "1.6.1",
|
|
37
37
|
"@molecule/api-bond": "1.0.4",
|
|
38
38
|
"@molecule/api-secrets": "1.0.2",
|
|
39
39
|
"@types/node": "26.6.5",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"vitest": "4.1.12"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@molecule/api-ai": "^1.0
|
|
44
|
+
"@molecule/api-ai": "^1.6.0",
|
|
45
45
|
"@molecule/api-bond": "^1.0.1",
|
|
46
46
|
"@molecule/api-i18n": "^1.0.1",
|
|
47
47
|
"@molecule/api-secrets": "^1.0.1"
|