File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff 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,
You can’t perform that action at this time.
0 commit comments