Format the prompt with the chatglm3 style.
(
system_message: str, messages: List[Tuple[str, Optional[str]]], sep: str
)
| 983 | |
| 984 | |
| 985 | def _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 | |
| 1000 | def _grammar_for_json(verbose: bool = False): |
no outgoing calls
no test coverage detected
searching dependent graphs…