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.cjs CHANGED
@@ -9545,13 +9545,24 @@ ${endPrefix}`
9545
9545
  observers: {
9546
9546
  ...hooks?.observers,
9547
9547
  onLLMCallStart: async (context) => {
9548
+ let inputTokens;
9549
+ try {
9550
+ if (this.client) {
9551
+ inputTokens = await this.client.countTokens(
9552
+ context.options.model,
9553
+ context.options.messages
9554
+ );
9555
+ }
9556
+ } catch {
9557
+ }
9548
9558
  onSubagentEvent({
9549
9559
  type: "llm_call_start",
9550
9560
  gadgetInvocationId: invocationId,
9551
9561
  depth,
9552
9562
  event: {
9553
9563
  iteration: context.iteration,
9554
- model: context.options.model
9564
+ model: context.options.model,
9565
+ inputTokens
9555
9566
  }
9556
9567
  });
9557
9568
  if (existingOnLLMCallStart) {