@@ -212,9 +212,9 @@ impl MistralRsEngine {
212
212
213
213
// Perform warmup request
214
214
let ( tx, mut rx) = channel ( 1 ) ;
215
- let request_id = engine. mistralrs . next_request_id ( ) ;
215
+ let mistralrs_request_id = engine. mistralrs . next_request_id ( ) ;
216
216
let warmup_request = Request :: Normal ( Box :: new ( NormalRequest {
217
- id : request_id ,
217
+ id : mistralrs_request_id ,
218
218
model_id : Some ( display_name. to_string ( ) ) ,
219
219
messages : RequestMessage :: Chat {
220
220
messages : vec ! [ IndexMap :: from( [
@@ -246,10 +246,10 @@ impl MistralRsEngine {
246
246
{
247
247
match response. as_result ( ) {
248
248
Ok ( r) => {
249
- tracing:: debug!( request_id , "Warmup response: {r:?}" ) ;
249
+ tracing:: debug!( mistralrs_request_id , "Warmup response: {r:?}" ) ;
250
250
}
251
251
Err ( err) => {
252
- tracing:: error!( request_id , %err, "Failed converting response to result." ) ;
252
+ tracing:: error!( mistralrs_request_id , %err, "Failed converting response to result." ) ;
253
253
}
254
254
}
255
255
}
272
272
) -> Result < ManyOut < Annotated < NvCreateChatCompletionStreamResponse > > , Error > {
273
273
let ( request, context) = request. transfer ( ( ) ) ;
274
274
let ctx = context. context ( ) ;
275
+ let request_id = ctx. id ( ) . to_string ( ) ;
275
276
let ( tx, mut rx) = channel ( 10_000 ) ;
276
277
277
278
let mut messages = vec ! [ ] ;
338
339
n_choices : 1 ,
339
340
dry_params : det. dry_params ,
340
341
} ;
341
- let request_id = self . mistralrs . next_request_id ( ) ;
342
+ let mistralrs_request_id = self . mistralrs . next_request_id ( ) ;
342
343
let mistralrs_request = Request :: Normal ( Box :: new ( NormalRequest {
343
- id : request_id ,
344
+ id : mistralrs_request_id ,
344
345
model_id : Some ( self . display_name . clone ( ) ) ,
345
346
messages : RequestMessage :: Chat {
346
347
messages,
@@ -369,14 +370,14 @@ impl
369
370
let response = match response. as_result( ) {
370
371
Ok ( r) => r,
371
372
Err ( err) => {
372
- tracing:: error!( request_id , %err, "Failed converting mistralrs channel response to result." ) ;
373
+ tracing:: error!( mistralrs_request_id , %err, "Failed converting mistralrs channel response to result." ) ;
373
374
break ;
374
375
}
375
376
} ;
376
377
match response {
377
378
ResponseOk :: Chunk ( c) => {
378
379
let Some ( from_assistant) = c. choices[ 0 ] . delta. content. clone( ) else {
379
- tracing:: warn!( request_id , "No content from mistralrs. Abandoning request." ) ;
380
+ tracing:: warn!( mistralrs_request_id , "No content from mistralrs. Abandoning request." ) ;
380
381
break ;
381
382
} ;
382
383
let finish_reason = match & c. choices[ 0 ] . finish_reason. as_deref( ) {
387
388
Some ( FinishReason :: Length )
388
389
}
389
390
Some ( s) => {
390
- tracing:: warn!( request_id , stop_reason = s, "Unknow stop reason" ) ;
391
+ tracing:: warn!( mistralrs_request_id , stop_reason = s, "Unknow stop reason" ) ;
391
392
Some ( FinishReason :: Stop )
392
393
}
393
394
None => None ,
396
397
397
398
#[ allow( deprecated) ]
398
399
let delta = NvCreateChatCompletionStreamResponse {
399
- id: c . id ,
400
+ id: format! ( "chatcmpl-{request_id}" ) ,
400
401
choices: vec![ dynamo_async_openai:: types:: ChatChoiceStream {
401
402
index: 0 ,
402
403
delta: dynamo_async_openai:: types:: ChatCompletionStreamResponseDelta {
@@ -427,11 +428,11 @@ impl
427
428
yield ann;
428
429
429
430
if finish_reason. is_some( ) {
430
- //tracing::trace!(request_id , "Finish reason: {finish_reason:?}");
431
+ //tracing::trace!(mistralrs_request_id , "Finish reason: {finish_reason:?}");
431
432
break ;
432
433
}
433
434
} ,
434
- x => tracing:: error!( request_id , "Unhandled. {x:?}" ) ,
435
+ x => tracing:: error!( mistralrs_request_id , "Unhandled. {x:?}" ) ,
435
436
}
436
437
}
437
438
} ;
485
486
let ( request, context) = request. transfer ( ( ) ) ;
486
487
let ctx = context. context ( ) ;
487
488
let ( tx, mut rx) = channel ( 10_000 ) ;
488
- let response_generator = request. response_generator ( ) ;
489
+ let response_generator = request. response_generator ( ctx . id ( ) . to_string ( ) ) ;
489
490
490
491
let messages = RequestMessage :: Completion {
491
492
text : prompt_to_string ( & request. inner . prompt ) ,
539
540
dry_params : det. dry_params ,
540
541
} ;
541
542
542
- let request_id = self . mistralrs . next_request_id ( ) ;
543
+ let mistralrs_request_id = self . mistralrs . next_request_id ( ) ;
543
544
let mistralrs_request = Request :: Normal ( Box :: new ( NormalRequest {
544
- id : request_id ,
545
+ id : mistralrs_request_id ,
545
546
model_id : Some ( self . display_name . clone ( ) ) ,
546
547
messages,
547
548
sampling_params,
567
568
let response = match response. as_result( ) {
568
569
Ok ( r) => r,
569
570
Err ( err) => {
570
- tracing:: error!( request_id , %err, "Failed converting mistralrs channel response to result." ) ;
571
+ tracing:: error!( mistralrs_request_id , %err, "Failed converting mistralrs channel response to result." ) ;
571
572
break ;
572
573
}
573
574
} ;
583
584
Some ( FinishReason :: Length )
584
585
}
585
586
Some ( s) => {
586
- tracing:: warn!( request_id , stop_reason = s, "Unknow stop reason" ) ;
587
+ tracing:: warn!( mistralrs_request_id , stop_reason = s, "Unknow stop reason" ) ;
587
588
Some ( FinishReason :: Stop )
588
589
}
589
590
None => None ,
602
603
break ;
603
604
}
604
605
} ,
605
- x => tracing:: error!( request_id , "Unhandled. {x:?}" ) ,
606
+ x => tracing:: error!( mistralrs_request_id , "Unhandled. {x:?}" ) ,
606
607
}
607
608
}
608
609
} ;
0 commit comments