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

Function format_zephyr

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

Source from the content-addressed store, hash-verified

1308
1309@register_chat_format("zephyr")
1310def format_zephyr(
1311 messages: List[llama_types.ChatCompletionRequestMessage],
1312 **kwargs: Any,
1313) -> ChatFormatterResponse:
1314 system_template = """<|system|>
1315{system_message}"""
1316 system_message = _get_system_message(messages)
1317 system_message = system_template.format(system_message=system_message)
1318 _roles = dict(user="<|user|>\n", assistant="<|assistant|>\n")
1319 _sep = "</s>"
1320 _messages = _map_roles(messages, _roles)
1321 _messages.append((_roles["assistant"], None))
1322 _prompt = _format_chatml(system_message, _messages, _sep)
1323 return ChatFormatterResponse(prompt=_prompt, stop=_sep)
1324
1325
1326@register_chat_format("pygmalion")

Callers

nothing calls this directly

Calls 6

_get_system_messageFunction · 0.85
_map_rolesFunction · 0.85
_format_chatmlFunction · 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…