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

Function format_baichuan

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

Source from the content-addressed store, hash-verified

1161
1162@register_chat_format("baichuan")
1163def format_baichuan(
1164 messages: List[llama_types.ChatCompletionRequestMessage],
1165 **kwargs: Any,
1166) -> ChatFormatterResponse:
1167 _system_template = "{system_message}"
1168 _roles = dict(user="<reserved_102>", assistant="<reserved_103>")
1169 _sep = ""
1170 system_message = _get_system_message(messages)
1171 system_message = _system_template.format(system_message=system_message)
1172 _messages = _map_roles(messages, _roles)
1173 _messages.append((_roles["assistant"], None))
1174 _prompt = _format_no_colon_single(system_message, _messages, _sep)
1175 return ChatFormatterResponse(prompt=_prompt)
1176
1177
1178@register_chat_format("openbuddy")

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…