Apply chat template. Args: tmpl: Template to use. If None, uses model's default chat: Array of chat messages n_msg: Number of messages add_ass: Whether to end prompt with assistant token buf: Output buffer length: Buffer length Returns:
(
tmpl: bytes,
chat: CtypesArray[llama_chat_message],
n_msg: int,
add_ass: bool, # Added parameter
buf: bytes,
length: int,
/,
)
| 4130 | ctypes.c_int32, |
| 4131 | ) |
| 4132 | def llama_chat_apply_template( |
| 4133 | tmpl: bytes, |
| 4134 | chat: CtypesArray[llama_chat_message], |
| 4135 | n_msg: int, |
| 4136 | add_ass: bool, # Added parameter |
| 4137 | buf: bytes, |
| 4138 | length: int, |
| 4139 | /, |
| 4140 | ) -> int: |
| 4141 | """Apply chat template. |
| 4142 | |
| 4143 | Args: |
| 4144 | tmpl: Template to use. If None, uses model's default |
| 4145 | chat: Array of chat messages |
| 4146 | n_msg: Number of messages |
| 4147 | add_ass: Whether to end prompt with assistant token |
| 4148 | buf: Output buffer |
| 4149 | length: Buffer length |
| 4150 | |
| 4151 | Returns: |
| 4152 | Number of bytes written, or needed if buffer too small |
| 4153 | """ |
| 4154 | ... |
| 4155 | |
| 4156 | |
| 4157 | # // Get list of built-in chat templates |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…