@@ -212,9 +212,9 @@ impl MistralRsEngine {
212212
213213 // Perform warmup request
214214 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 ( ) ;
216216 let warmup_request = Request :: Normal ( Box :: new ( NormalRequest {
217- id : request_id ,
217+ id : mistralrs_request_id ,
218218 model_id : Some ( display_name. to_string ( ) ) ,
219219 messages : RequestMessage :: Chat {
220220 messages : vec ! [ IndexMap :: from( [
@@ -246,10 +246,10 @@ impl MistralRsEngine {
246246 {
247247 match response. as_result ( ) {
248248 Ok ( r) => {
249- tracing:: debug!( request_id , "Warmup response: {r:?}" ) ;
249+ tracing:: debug!( mistralrs_request_id , "Warmup response: {r:?}" ) ;
250250 }
251251 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." ) ;
253253 }
254254 }
255255 }
272272 ) -> Result < ManyOut < Annotated < NvCreateChatCompletionStreamResponse > > , Error > {
273273 let ( request, context) = request. transfer ( ( ) ) ;
274274 let ctx = context. context ( ) ;
275+ let request_id = ctx. id ( ) . to_string ( ) ;
275276 let ( tx, mut rx) = channel ( 10_000 ) ;
276277
277278 let mut messages = vec ! [ ] ;
338339 n_choices : 1 ,
339340 dry_params : det. dry_params ,
340341 } ;
341- let request_id = self . mistralrs . next_request_id ( ) ;
342+ let mistralrs_request_id = self . mistralrs . next_request_id ( ) ;
342343 let mistralrs_request = Request :: Normal ( Box :: new ( NormalRequest {
343- id : request_id ,
344+ id : mistralrs_request_id ,
344345 model_id : Some ( self . display_name . clone ( ) ) ,
345346 messages : RequestMessage :: Chat {
346347 messages,
@@ -369,14 +370,14 @@ impl
369370 let response = match response. as_result( ) {
370371 Ok ( r) => r,
371372 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." ) ;
373374 break ;
374375 }
375376 } ;
376377 match response {
377378 ResponseOk :: Chunk ( c) => {
378379 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." ) ;
380381 break ;
381382 } ;
382383 let finish_reason = match & c. choices[ 0 ] . finish_reason. as_deref( ) {
387388 Some ( FinishReason :: Length )
388389 }
389390 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" ) ;
391392 Some ( FinishReason :: Stop )
392393 }
393394 None => None ,
396397
397398 #[ allow( deprecated) ]
398399 let delta = NvCreateChatCompletionStreamResponse {
399- id: c . id ,
400+ id: format! ( "chatcmpl-{request_id}" ) ,
400401 choices: vec![ dynamo_async_openai:: types:: ChatChoiceStream {
401402 index: 0 ,
402403 delta: dynamo_async_openai:: types:: ChatCompletionStreamResponseDelta {
@@ -427,11 +428,11 @@ impl
427428 yield ann;
428429
429430 if finish_reason. is_some( ) {
430- //tracing::trace!(request_id , "Finish reason: {finish_reason:?}");
431+ //tracing::trace!(mistralrs_request_id , "Finish reason: {finish_reason:?}");
431432 break ;
432433 }
433434 } ,
434- x => tracing:: error!( request_id , "Unhandled. {x:?}" ) ,
435+ x => tracing:: error!( mistralrs_request_id , "Unhandled. {x:?}" ) ,
435436 }
436437 }
437438 } ;
485486 let ( request, context) = request. transfer ( ( ) ) ;
486487 let ctx = context. context ( ) ;
487488 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 ( ) ) ;
489490
490491 let messages = RequestMessage :: Completion {
491492 text : prompt_to_string ( & request. inner . prompt ) ,
539540 dry_params : det. dry_params ,
540541 } ;
541542
542- let request_id = self . mistralrs . next_request_id ( ) ;
543+ let mistralrs_request_id = self . mistralrs . next_request_id ( ) ;
543544 let mistralrs_request = Request :: Normal ( Box :: new ( NormalRequest {
544- id : request_id ,
545+ id : mistralrs_request_id ,
545546 model_id : Some ( self . display_name . clone ( ) ) ,
546547 messages,
547548 sampling_params,
567568 let response = match response. as_result( ) {
568569 Ok ( r) => r,
569570 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." ) ;
571572 break ;
572573 }
573574 } ;
583584 Some ( FinishReason :: Length )
584585 }
585586 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" ) ;
587588 Some ( FinishReason :: Stop )
588589 }
589590 None => None ,
602603 break ;
603604 }
604605 } ,
605- x => tracing:: error!( request_id , "Unhandled. {x:?}" ) ,
606+ x => tracing:: error!( mistralrs_request_id , "Unhandled. {x:?}" ) ,
606607 }
607608 }
608609 } ;
0 commit comments