2121 resolve_chat_template_content_format )
2222
2323
24- def is_chat_completions_request (inputs : Dict ) -> bool :
25- return "messages" in inputs
26-
27-
2824def parse_chat_completions_request_vllm (
2925 input_map : Dict ,
3026 is_rolling_batch : bool ,
3127 rolling_batch ,
3228 tokenizer ,
33- chat_template : Optional [str ] = None ,
3429 configs : Properties = None ,
3530 is_mistral_tokenizer : bool = False ,
3631):
@@ -41,12 +36,6 @@ def parse_chat_completions_request_vllm(
4136 "You must enable rolling batch to use the chat completions format."
4237 )
4338
44- if not is_mistral_tokenizer and not hasattr (tokenizer ,
45- "apply_chat_template" ):
46- raise AttributeError (
47- f"Cannot provide chat completion for tokenizer: { tokenizer .__class__ } , "
48- f"please ensure that your tokenizer supports chat templates." )
49-
5039 tool_parser = rolling_batch .get_tool_parser ()
5140 chat_params = ChatProperties (** input_map )
5241
@@ -85,16 +74,15 @@ def parse_chat_completions_request_vllm(
8574 if is_mistral_tokenizer :
8675 text_inputs = apply_mistral_chat_template (
8776 tokenizer ,
88- messages = chat_params .messages ,
89- chat_template = chat_template ,
90- add_generation_prompt = True ,
77+ chat_params .messages ,
78+ None ,
9179 tools = tool_dicts ,
9280 )
9381 else :
9482 text_inputs = apply_hf_chat_template (
9583 tokenizer ,
96- conversation = conversation ,
97- chat_template = chat_template ,
84+ conversation ,
85+ None ,
9886 add_generation_prompt = True ,
9987 tools = tool_dicts ,
10088 )
0 commit comments