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

Function _format_chatglm3

llama_cpp/llama_chat_format.py:985–997  ·  view source on GitHub ↗

Format the prompt with the chatglm3 style.

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

Source from the content-addressed store, hash-verified

983
984
985def _format_chatglm3(
986 system_message: str, messages: List[Tuple[str, Optional[str]]], sep: str
987) -> str:
988 """Format the prompt with the chatglm3 style."""
989 ret = ""
990 if system_message:
991 ret += system_message
992 for role, message in messages:
993 if message:
994 ret += role + "\n" + " " + message
995 else:
996 ret += role
997 return ret
998
999
1000def _grammar_for_json(verbose: bool = False):

Callers 1

format_chatglm3Function · 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…