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

Function format_snoozy

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

Source from the content-addressed store, hash-verified

1215
1216@register_chat_format("snoozy")
1217def format_snoozy(
1218 messages: List[llama_types.ChatCompletionRequestMessage],
1219 **kwargs: Any,
1220) -> ChatFormatterResponse:
1221 system_template = "### Instruction:\n{system_message}"
1222 default_system_message = "The prompt below is a question to answer, a task to complete, or a conversation to respond to; decide which and write an appropriate response."
1223 _system_message = _get_system_message(messages)
1224 _system_message = (
1225 _system_message if _system_message != "" else default_system_message
1226 )
1227 system_message = system_template.format(system_message=_system_message)
1228 _roles = dict(user="### Prompt", assistant="### Response")
1229 _sep = "\n"
1230 _stop = "###"
1231 system_message = _system_message
1232 _messages = _map_roles(messages, _roles)
1233 _messages.append((_roles["assistant"], None))
1234 _prompt = _format_add_colon_single(system_message, _messages, _sep)
1235 return ChatFormatterResponse(prompt=_prompt, stop=_stop)
1236
1237
1238@register_chat_format("phind")

Callers

nothing calls this directly

Calls 6

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