File tree Expand file tree Collapse file tree
packages/core/src/routing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export class ModelRouterService {
7474 */
7575 async route ( context : RoutingContext ) : Promise < RoutingDecision > {
7676 const startTime = Date . now ( ) ;
77- let decision : RoutingDecision ;
77+ let decision : RoutingDecision | undefined ;
7878
7979 const [ enableNumericalRouting , thresholdValue ] = await Promise . all ( [
8080 this . config . getNumericalRoutingEnabled ( ) ,
@@ -117,10 +117,10 @@ export class ModelRouterService {
117117 ) ;
118118 } finally {
119119 const event = new ModelRoutingEvent (
120- decision ! . model ,
121- decision ! . metadata . source ,
122- decision ! . metadata . latencyMs ,
123- decision ! . metadata . reasoning ,
120+ decision ? .model || 'unknown' ,
121+ decision ? .metadata ? .source || 'unknown' ,
122+ decision ? .metadata ? .latencyMs || 0 ,
123+ decision ? .metadata ? .reasoning ,
124124 failed ,
125125 error_message ,
126126 this . config . getApprovalMode ( ) ,
You can’t perform that action at this time.
0 commit comments