@latitude-data/telemetry 1.0.2 → 1.0.3
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 +2 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -40
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1584,44 +1584,6 @@ class LatitudeInstrumentation {
|
|
|
1584
1584
|
// Note: this is an estimation to not bundle a tokenizer
|
|
1585
1585
|
return Math.ceil(length / 4);
|
|
1586
1586
|
}
|
|
1587
|
-
withTraceContext(ctx, fn) {
|
|
1588
|
-
return context.with(this.telemetry.resume(ctx), fn);
|
|
1589
|
-
}
|
|
1590
|
-
async wrapToolHandler(fn, ...args) {
|
|
1591
|
-
const toolArguments = args[0];
|
|
1592
|
-
const { id, name } = args[1];
|
|
1593
|
-
const $tool = this.telemetry.tool(context.active(), {
|
|
1594
|
-
name,
|
|
1595
|
-
call: {
|
|
1596
|
-
id,
|
|
1597
|
-
arguments: toolArguments,
|
|
1598
|
-
},
|
|
1599
|
-
});
|
|
1600
|
-
let result;
|
|
1601
|
-
try {
|
|
1602
|
-
result = await context.with($tool.context, async () => await fn(...args));
|
|
1603
|
-
}
|
|
1604
|
-
catch (error) {
|
|
1605
|
-
if (error.name === 'ToolExecutionPausedError') {
|
|
1606
|
-
$tool.fail(error);
|
|
1607
|
-
throw error;
|
|
1608
|
-
}
|
|
1609
|
-
$tool.end({
|
|
1610
|
-
result: {
|
|
1611
|
-
value: error.message,
|
|
1612
|
-
isError: true,
|
|
1613
|
-
},
|
|
1614
|
-
});
|
|
1615
|
-
throw error;
|
|
1616
|
-
}
|
|
1617
|
-
$tool.end({
|
|
1618
|
-
result: {
|
|
1619
|
-
value: result,
|
|
1620
|
-
isError: false,
|
|
1621
|
-
},
|
|
1622
|
-
});
|
|
1623
|
-
return result;
|
|
1624
|
-
}
|
|
1625
1587
|
async wrapRenderChain(fn, ...args) {
|
|
1626
1588
|
const { prompt, parameters } = args[0];
|
|
1627
1589
|
const $prompt = this.telemetry.prompt(context.active(), {
|
|
@@ -1711,8 +1673,8 @@ class LatitudeInstrumentation {
|
|
|
1711
1673
|
}
|
|
1712
1674
|
$tool.end({
|
|
1713
1675
|
result: {
|
|
1714
|
-
value: result,
|
|
1715
|
-
isError:
|
|
1676
|
+
value: result.result,
|
|
1677
|
+
isError: result.isError,
|
|
1716
1678
|
},
|
|
1717
1679
|
});
|
|
1718
1680
|
return result;
|