Unverified Commit 5e443b59 authored by sasha0552's avatar sasha0552 Committed by GitHub
Browse files

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

parent 9d30a056
...@@ -166,6 +166,10 @@ class MistralTokenizer: ...@@ -166,6 +166,10 @@ class MistralTokenizer:
tools: Optional[Dict[str, Any]] = None, tools: Optional[Dict[str, Any]] = None,
**kwargs) -> List[int]: **kwargs) -> List[int]:
last_message = messages[-1]
if last_message["role"] == "assistant":
last_message["prefix"] = True
request = ChatCompletionRequest(messages=messages, request = ChatCompletionRequest(messages=messages,
tools=tools) # type: ignore[type-var] tools=tools) # type: ignore[type-var]
encoded = self.mistral.encode_chat_completion(request) encoded = self.mistral.encode_chat_completion(request)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment