Skip to content

Commit

Permalink
[Bugfix] Allow prefill of assistant response when using `mistral_comm…
Browse files Browse the repository at this point in the history
…on` (vllm-project#9446)

Signed-off-by: qishuai <[email protected]>
  • Loading branch information
sasha0552 authored and FerdinandZhong committed Oct 29, 2024
1 parent d5e2294 commit 712d250
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions vllm/transformers_utils/tokenizers/mistral.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ def apply_chat_template(self,
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)
Expand Down

0 comments on commit 712d250

Please sign in to comment.