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

Function format_pygmalion

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

Source from the content-addressed store, hash-verified

1325
1326@register_chat_format("pygmalion")
1327def format_pygmalion(
1328 messages: List[llama_types.ChatCompletionRequestMessage],
1329 **kwargs: Any,
1330) -> ChatFormatterResponse:
1331 system_template = """<|system|>{system_message}"""
1332 system_message = _get_system_message(messages)
1333 system_message = system_template.format(system_message=system_message)
1334 _roles = dict(user="<|user|>", assistant="<|model|>")
1335 _sep = "\n"
1336 _messages = _map_roles(messages, _roles)
1337 _messages.append((_roles["assistant"], None))
1338 _prompt = _format_chatml(system_message, _messages, _sep)
1339 return ChatFormatterResponse(prompt=_prompt, stop=_sep)
1340
1341
1342@register_chat_format("chatml")

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…