File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed 
vllm/transformers_utils/tokenizers Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,16 @@ def apply_chat_template(self,
291291
292292        from  mistral_common .protocol .instruct .request  import  (
293293            ChatCompletionRequest )
294+ 
295+         # mistral-common requires AssistantMessage content to be string [1]. 
296+         # 
297+         # [1]: https://github.com/mistralai/mistral-common/blob/f4a06998b75ed78bbf5aaf569590b772ea26c9f6/src/mistral_common/protocol/instruct/messages.py#L80 
298+         for  message  in  messages :
299+             if  message .get ("role" ) ==  "assistant" :
300+                 content  =  message .get ("content" )
301+                 if  isinstance (content , list ):
302+                     content  =  "\n " .join (chunk .get ("text" ) for  chunk  in  content )
303+                     message ["content" ] =  content 
294304        request  =  ChatCompletionRequest (messages = messages ,
295305                                        tools = tools )  # type: ignore[type-var] 
296306        encoded  =  self .mistral .encode_chat_completion (request )
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments