[Frontend] Generate valid tool call IDs when using tokenizer-mode=mistral (#12332)

This commit is contained in:
Rafael Vasquez
2025-02-12 08:29:56 -08:00
committed by GitHub
parent 985b4a2b19
commit 314cfade02
8 changed files with 149 additions and 8 deletions
@@ -33,7 +33,7 @@ class MistralToolCall(ToolCall):
@staticmethod
def generate_random_id():
# Mistral Tool Call Ids must be alphanumeric with a maximum length of 9.
# Mistral Tool Call Ids must be alphanumeric with a length of 9.
# https://github.com/mistralai/mistral-common/blob/21ee9f6cee3441e9bb1e6ed2d10173f90bd9b94b/src/mistral_common/protocol/instruct/validator.py#L299
return "".join(choices(ALPHANUMERIC, k=9))