MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / format_oasst_llama

Function format_oasst_llama

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

Source from the content-addressed store, hash-verified

1129
1130@register_chat_format("oasst_llama")
1131def format_oasst_llama(
1132 messages: List[llama_types.ChatCompletionRequestMessage],
1133 **kwargs: Any,
1134) -> ChatFormatterResponse:
1135 _system_template = "[INST] <<SYS>>\n{system_message}\n<</SYS>>\n\n"
1136 _roles = dict(user="<|prompter|>", assistant="<|assistant|>")
1137 _sep = "</s>"
1138 system_message = _get_system_message(messages)
1139 system_message = _system_template.format(system_message=system_message)
1140 _messages = _map_roles(messages, _roles)
1141 _messages.append((_roles["assistant"], None))
1142 _prompt = _format_no_colon_single(system_message, _messages, _sep)
1143 return ChatFormatterResponse(prompt=_prompt)
1144
1145
1146@register_chat_format("baichuan-2")

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…