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

Function _format_chatml

llama_cpp/llama_chat_format.py:972–982  ·  view source on GitHub ↗

Format the prompt with the chatml style.

(
    system_message: str, messages: List[Tuple[str, Optional[str]]], sep: str
)

Source from the content-addressed store, hash-verified

970
971
972def _format_chatml(
973 system_message: str, messages: List[Tuple[str, Optional[str]]], sep: str
974) -> str:
975 """Format the prompt with the chatml style."""
976 ret = "" if system_message == "" else system_message + sep + "\n"
977 for role, message in messages:
978 if message:
979 ret += role + "\n" + message + sep + "\n"
980 else:
981 ret += role + "\n"
982 return ret
983
984
985def _format_chatglm3(

Callers 5

format_qwenFunction · 0.85
format_zephyrFunction · 0.85
format_pygmalionFunction · 0.85
format_chatmlFunction · 0.85
format_openchatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…