@@ -661,18 +661,32 @@ def _generate(self,
661
661
pass # noqa F841
662
662
663
663
# Check if response is empty or content is empty
664
- if not responses .choices or not responses .choices [
665
- 0 ].message .content :
664
+ if ( not responses .choices or not responses .choices [0 ]. message
665
+ or not responses . choices [ 0 ].message .content ) :
666
666
self .logger .error (
667
- 'API response is empty, it might be due to excessive '
668
- 'input length or an internal server error '
669
- 'from your API provider.' )
667
+ 'Failed to extract content from the responses. '
668
+ 'Please check the API response for detail information.'
669
+ 'API responses: %s' ,
670
+ responses ,
671
+ )
670
672
num_retries += 1
671
673
# Continue to retry instead of returning empty response
672
674
continue
673
- # If the model has reasoning_content, concat it
674
- # with the content
675
- if hasattr (responses .choices [0 ].message , 'reasoning_content' ):
675
+
676
+ # Concat Reasoning Content and tags to content
677
+ if (hasattr (responses .choices [0 ].message , 'reasoning_content' )
678
+ and responses .choices [0 ].message .reasoning_content ):
679
+ if self .verbose :
680
+ self .logger .info (
681
+ 'Follow'
682
+ 'vllm/reasoning/deepseek_r1_reasoning_parser'
683
+ 'to parse the reasoning content and tags'
684
+ 'Reasoning Content: %s, \n '
685
+ 'Tags: %s, \n '
686
+ 'Content: %s' ,
687
+ responses .choices [0 ].message .reasoning_content ,
688
+ self .think_tag ,
689
+ responses .choices [0 ].message .content )
676
690
return (responses .choices [0 ].message .reasoning_content +
677
691
self .think_tag +
678
692
responses .choices [0 ].message .content )
0 commit comments