[Bugfix] Allow prefill of assistant response when using mistral_common (#9446)

This commit is contained in:
sasha0552 2024-10-17 15:06:37 +00:00 committed by GitHub
parent 9d30a056e7
commit 5e443b594f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,6 +166,10 @@ class MistralTokenizer:
tools: Optional[Dict[str, Any]] = None,
**kwargs) -> List[int]:
last_message = messages[-1]
if last_message["role"] == "assistant":
last_message["prefix"] = True
request = ChatCompletionRequest(messages=messages,
tools=tools) # type: ignore[type-var]
encoded = self.mistral.encode_chat_completion(request)