MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / format_mistrallite

Function format_mistrallite

llama_cpp/llama_chat_format.py:1294–1306  ·  view source on GitHub ↗
(
    messages: List[llama_types.ChatCompletionRequestMessage],
    **kwargs: Any,
)

Source from the content-addressed store, hash-verified

1292
1293@register_chat_format("mistrallite")
1294def format_mistrallite(
1295 messages: List[llama_types.ChatCompletionRequestMessage],
1296 **kwargs: Any,
1297) -> ChatFormatterResponse:
1298 _roles = dict(user="<|prompter|>", assistant="</s>\n<|assistant|>")
1299 _sep = " "
1300 system_template = """<|system|>{system_message}</s>"""
1301 system_message = _get_system_message(messages)
1302 system_message = system_template.format(system_message=system_message)
1303 _messages = _map_roles(messages, _roles)
1304 _messages.append((_roles["assistant"], None))
1305 _prompt = _format_no_colon_single(system_message, _messages, _sep)
1306 return ChatFormatterResponse(prompt=_prompt)
1307
1308
1309@register_chat_format("zephyr")

Callers

nothing calls this directly

Calls 6

_get_system_messageFunction · 0.85
_map_rolesFunction · 0.85
_format_no_colon_singleFunction · 0.85
formatMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…