@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.cjs
CHANGED
|
@@ -1604,44 +1604,6 @@ class LatitudeInstrumentation {
|
|
|
1604
1604
|
// Note: this is an estimation to not bundle a tokenizer
|
|
1605
1605
|
return Math.ceil(length / 4);
|
|
1606
1606
|
}
|
|
1607
|
-
withTraceContext(ctx, fn) {
|
|
1608
|
-
return otel.context.with(this.telemetry.resume(ctx), fn);
|
|
1609
|
-
}
|
|
1610
|
-
async wrapToolHandler(fn, ...args) {
|
|
1611
|
-
const toolArguments = args[0];
|
|
1612
|
-
const { id, name } = args[1];
|
|
1613
|
-
const $tool = this.telemetry.tool(otel.context.active(), {
|
|
1614
|
-
name,
|
|
1615
|
-
call: {
|
|
1616
|
-
id,
|
|
1617
|
-
arguments: toolArguments,
|
|
1618
|
-
},
|
|
1619
|
-
});
|
|
1620
|
-
let result;
|
|
1621
|
-
try {
|
|
1622
|
-
result = await otel.context.with($tool.context, async () => await fn(...args));
|
|
1623
|
-
}
|
|
1624
|
-
catch (error) {
|
|
1625
|
-
if (error.name === 'ToolExecutionPausedError') {
|
|
1626
|
-
$tool.fail(error);
|
|
1627
|
-
throw error;
|
|
1628
|
-
}
|
|
1629
|
-
$tool.end({
|
|
1630
|
-
result: {
|
|
1631
|
-
value: error.message,
|
|
1632
|
-
isError: true,
|
|
1633
|
-
},
|
|
1634
|
-
});
|
|
1635
|
-
throw error;
|
|
1636
|
-
}
|
|
1637
|
-
$tool.end({
|
|
1638
|
-
result: {
|
|
1639
|
-
value: result,
|
|
1640
|
-
isError: false,
|
|
1641
|
-
},
|
|
1642
|
-
});
|
|
1643
|
-
return result;
|
|
1644
|
-
}
|
|
1645
1607
|
async wrapRenderChain(fn, ...args) {
|
|
1646
1608
|
const { prompt, parameters } = args[0];
|
|
1647
1609
|
const $prompt = this.telemetry.prompt(otel.context.active(), {
|
|
@@ -1731,8 +1693,8 @@ class LatitudeInstrumentation {
|
|
|
1731
1693
|
}
|
|
1732
1694
|
$tool.end({
|
|
1733
1695
|
result: {
|
|
1734
|
-
value: result,
|
|
1735
|
-
isError:
|
|
1696
|
+
value: result.result,
|
|
1697
|
+
isError: result.isError,
|
|
1736
1698
|
},
|
|
1737
1699
|
});
|
|
1738
1700
|
return result;
|