@agent-inspect/viewer 6.17.0 → 6.17.2
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 +18 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +18 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2811,6 +2811,18 @@ function stringAttr(event, keys) {
|
|
|
2811
2811
|
}
|
|
2812
2812
|
return void 0;
|
|
2813
2813
|
}
|
|
2814
|
+
function metadataStringAttr(event, keys) {
|
|
2815
|
+
const metadata = event.attributes?.metadata;
|
|
2816
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
|
|
2817
|
+
return void 0;
|
|
2818
|
+
}
|
|
2819
|
+
const record = metadata;
|
|
2820
|
+
for (const key of keys) {
|
|
2821
|
+
const value = record[key];
|
|
2822
|
+
if (typeof value === "string" && value.trim() !== "") return value;
|
|
2823
|
+
}
|
|
2824
|
+
return void 0;
|
|
2825
|
+
}
|
|
2814
2826
|
function stripPrefix(name, prefixes) {
|
|
2815
2827
|
for (const prefix of prefixes) {
|
|
2816
2828
|
if (name.startsWith(prefix)) return name.slice(prefix.length);
|
|
@@ -2855,13 +2867,16 @@ function semanticEvents(context) {
|
|
|
2855
2867
|
return context.logicalEvents ?? context.events;
|
|
2856
2868
|
}
|
|
2857
2869
|
function llmModel(event) {
|
|
2858
|
-
|
|
2870
|
+
const keys = ["model", "modelId", "responseModelId", "modelName", "model_name"];
|
|
2871
|
+
return stringAttr(event, keys) ?? metadataStringAttr(event, keys) ?? stripPrefix(event.name, ["llm:", "generation:", "transcription:", "speech:"]);
|
|
2859
2872
|
}
|
|
2860
2873
|
function llmProvider(event) {
|
|
2861
|
-
|
|
2874
|
+
const keys = ["provider", "providerName", "provider_name"];
|
|
2875
|
+
return stringAttr(event, keys) ?? metadataStringAttr(event, keys);
|
|
2862
2876
|
}
|
|
2863
2877
|
function llmFinishReason(event) {
|
|
2864
|
-
|
|
2878
|
+
const keys = ["finishReason", "rawFinishReason", "finish_reason"];
|
|
2879
|
+
return stringAttr(event, keys) ?? metadataStringAttr(event, keys);
|
|
2865
2880
|
}
|
|
2866
2881
|
function finishedEvents(context, kind) {
|
|
2867
2882
|
return semanticEvents(context).filter(
|