@agent-inspect/viewer 6.17.1 → 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.cjs
CHANGED
|
@@ -2818,6 +2818,18 @@ function stringAttr(event, keys) {
|
|
|
2818
2818
|
}
|
|
2819
2819
|
return void 0;
|
|
2820
2820
|
}
|
|
2821
|
+
function metadataStringAttr(event, keys) {
|
|
2822
|
+
const metadata = event.attributes?.metadata;
|
|
2823
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata)) {
|
|
2824
|
+
return void 0;
|
|
2825
|
+
}
|
|
2826
|
+
const record = metadata;
|
|
2827
|
+
for (const key of keys) {
|
|
2828
|
+
const value = record[key];
|
|
2829
|
+
if (typeof value === "string" && value.trim() !== "") return value;
|
|
2830
|
+
}
|
|
2831
|
+
return void 0;
|
|
2832
|
+
}
|
|
2821
2833
|
function stripPrefix(name, prefixes) {
|
|
2822
2834
|
for (const prefix of prefixes) {
|
|
2823
2835
|
if (name.startsWith(prefix)) return name.slice(prefix.length);
|
|
@@ -2862,13 +2874,16 @@ function semanticEvents(context) {
|
|
|
2862
2874
|
return context.logicalEvents ?? context.events;
|
|
2863
2875
|
}
|
|
2864
2876
|
function llmModel(event) {
|
|
2865
|
-
|
|
2877
|
+
const keys = ["model", "modelId", "responseModelId", "modelName", "model_name"];
|
|
2878
|
+
return stringAttr(event, keys) ?? metadataStringAttr(event, keys) ?? stripPrefix(event.name, ["llm:", "generation:", "transcription:", "speech:"]);
|
|
2866
2879
|
}
|
|
2867
2880
|
function llmProvider(event) {
|
|
2868
|
-
|
|
2881
|
+
const keys = ["provider", "providerName", "provider_name"];
|
|
2882
|
+
return stringAttr(event, keys) ?? metadataStringAttr(event, keys);
|
|
2869
2883
|
}
|
|
2870
2884
|
function llmFinishReason(event) {
|
|
2871
|
-
|
|
2885
|
+
const keys = ["finishReason", "rawFinishReason", "finish_reason"];
|
|
2886
|
+
return stringAttr(event, keys) ?? metadataStringAttr(event, keys);
|
|
2872
2887
|
}
|
|
2873
2888
|
function finishedEvents(context, kind) {
|
|
2874
2889
|
return semanticEvents(context).filter(
|