@runappsai/agent 0.3.1 → 0.3.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/agent-core.umd.js +38 -38
- package/dist/agent.js +4 -0
- package/dist/agent.umd.js +52 -52
- package/dist/chat.js +7 -4
- package/dist/index.cjs +4 -1
- package/dist/llm.d.ts +4 -0
- package/dist/types.d.ts +2 -0
- package/dist/ui.cjs +8 -2
- package/package.json +1 -1
package/dist/agent.js
CHANGED
|
@@ -1375,6 +1375,7 @@ export class Agent {
|
|
|
1375
1375
|
prompt_tokens: u.prompt_tokens - before.prompt_tokens,
|
|
1376
1376
|
completion_tokens: u.completion_tokens - before.completion_tokens,
|
|
1377
1377
|
calls: u.calls - before.calls,
|
|
1378
|
+
...((u.cached_tokens ?? 0) > (before.cached_tokens ?? 0) ? { cached_tokens: (u.cached_tokens ?? 0) - (before.cached_tokens ?? 0) } : {}),
|
|
1378
1379
|
};
|
|
1379
1380
|
return;
|
|
1380
1381
|
}
|
|
@@ -1387,6 +1388,9 @@ export class Agent {
|
|
|
1387
1388
|
this._usage.total_cost = round(this._usage.total_cost + (u.total_cost ?? 0));
|
|
1388
1389
|
this._usage.prompt_tokens += u.prompt_tokens ?? 0;
|
|
1389
1390
|
this._usage.completion_tokens += u.completion_tokens ?? 0;
|
|
1391
|
+
const cached = u.prompt_tokens_details?.cached_tokens ?? 0;
|
|
1392
|
+
if (cached > 0)
|
|
1393
|
+
this._usage.cached_tokens = (this._usage.cached_tokens ?? 0) + cached;
|
|
1390
1394
|
this._usage.calls++;
|
|
1391
1395
|
}
|
|
1392
1396
|
/** How full the model's context is: tokens the next call would send (estimated) against the window. */
|