[Bugfix] fix tool_parser error handling when serve a model not support it (#8709)
This commit is contained in:
@@ -61,8 +61,13 @@ class MistralToolParser(ToolParser):
|
||||
self.streamed_args_for_tool: List[str] = [
|
||||
] # map what has been streamed for each tool so far to a list
|
||||
self.bot_token = "[TOOL_CALLS]"
|
||||
self.bot_token_id = self.model_tokenizer.get_vocab()[self.bot_token]
|
||||
self.bot_token_id = self.model_tokenizer.get_vocab().get(
|
||||
self.bot_token, None)
|
||||
self.tool_call_regex = re.compile(r"\[{.*?}\]", re.DOTALL)
|
||||
if not self.bot_token_id:
|
||||
raise RuntimeError(
|
||||
"Mistral Tool Parser could not locate the tool call token in "
|
||||
"the tokenizer!")
|
||||
|
||||
def extract_tool_calls(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user