llmist 5.0.0 → 5.1.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.
package/dist/index.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  resultWithImages,
12
12
  resultWithMedia,
13
13
  z
14
- } from "./chunk-UBPZUVIN.js";
14
+ } from "./chunk-F5QK5YVI.js";
15
15
  import {
16
16
  AbortException,
17
17
  AbstractGadget,
@@ -89,7 +89,7 @@ import {
89
89
  toBase64,
90
90
  validateAndApplyDefaults,
91
91
  validateGadgetParams
92
- } from "./chunk-3SZIQI45.js";
92
+ } from "./chunk-YJKUWFIC.js";
93
93
  export {
94
94
  AbortException,
95
95
  AbstractGadget,
@@ -6194,13 +6194,24 @@ ${endPrefix}`
6194
6194
  observers: {
6195
6195
  ...hooks?.observers,
6196
6196
  onLLMCallStart: async (context) => {
6197
+ let inputTokens;
6198
+ try {
6199
+ if (this.client) {
6200
+ inputTokens = await this.client.countTokens(
6201
+ context.options.model,
6202
+ context.options.messages
6203
+ );
6204
+ }
6205
+ } catch {
6206
+ }
6197
6207
  onSubagentEvent({
6198
6208
  type: "llm_call_start",
6199
6209
  gadgetInvocationId: invocationId,
6200
6210
  depth,
6201
6211
  event: {
6202
6212
  iteration: context.iteration,
6203
- model: context.options.model
6213
+ model: context.options.model,
6214
+ inputTokens
6204
6215
  }
6205
6216
  });
6206
6217
  if (existingOnLLMCallStart) {