Skip to content

Commit 430c0e0

Browse files
committed
as string bad
1 parent 6e230f5 commit 430c0e0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/webapp/app/v3/utils/enrichCreatableEvents.server.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ function enrichLlmMetrics(event: CreateEventInput): void {
163163
: "";
164164
const operationId = typeof props["ai.operationId"] === "string"
165165
? props["ai.operationId"]
166-
: (props["gen_ai.operation.name"] as string) ?? (props["operation.name"] as string) ?? "";
166+
: typeof props["gen_ai.operation.name"] === "string"
167+
? props["gen_ai.operation.name"]
168+
: typeof props["operation.name"] === "string"
169+
? props["operation.name"]
170+
: "";
167171
const msToFirstChunk = typeof props["ai.response.msToFirstChunk"] === "number"
168172
? props["ai.response.msToFirstChunk"]
169173
: 0;
@@ -175,8 +179,8 @@ function enrichLlmMetrics(event: CreateEventInput): void {
175179

176180
// Set _llmMetrics side-channel for dual-write to llm_metrics_v1
177181
const llmMetrics: LlmMetricsData = {
178-
genAiSystem: (props["gen_ai.system"] as string) ?? "unknown",
179-
requestModel: (props["gen_ai.request.model"] as string) ?? responseModel,
182+
genAiSystem: typeof props["gen_ai.system"] === "string" ? props["gen_ai.system"] : "unknown",
183+
requestModel: typeof props["gen_ai.request.model"] === "string" ? props["gen_ai.request.model"] : responseModel,
180184
responseModel,
181185
matchedModelId: cost?.matchedModelId ?? "",
182186
operationId,

0 commit comments

Comments
 (0)