@probelabs/probe 0.6.0-rc136 → 0.6.0-rc138

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.
@@ -1270,6 +1270,9 @@ When troubleshooting:
1270
1270
  temperature: 0.3,
1271
1271
  });
1272
1272
 
1273
+ // Get the promise reference BEFORE consuming stream (doesn't lock it)
1274
+ const usagePromise = result.usage;
1275
+
1273
1276
  // Collect the streamed response - stream all content for now
1274
1277
  for await (const delta of result.textStream) {
1275
1278
  assistantResponseContent += delta;
@@ -1279,8 +1282,8 @@ When troubleshooting:
1279
1282
  }
1280
1283
  }
1281
1284
 
1282
- // Record token usage
1283
- const usage = await result.usage;
1285
+ // Record token usage - await the promise AFTER stream is consumed
1286
+ const usage = await usagePromise;
1284
1287
  if (usage) {
1285
1288
  this.tokenCounter.recordUsage(usage, result.experimental_providerMetadata);
1286
1289
  }
@@ -1,7 +1,5 @@
1
1
  import { createWriteStream } from 'fs';
2
- import corePkg from '@opentelemetry/core';
3
-
4
- const { ExportResultCode } = corePkg;
2
+ import { ExportResultCode } from '@opentelemetry/core';
5
3
 
6
4
  /**
7
5
  * File exporter for OpenTelemetry spans