vllm.renderers.kimi_k3
¶
Classes:
-
KimiK3Renderer–Render chat prompts with Kimi K3's Python XTML encoding.
KimiK3Renderer
¶
Bases: BaseRenderer[HfTokenizer]
Render chat prompts with Kimi K3's Python XTML encoding.
K3 ships no Jinja chat template; its tokenizer renders messages through
encoding_k3 instead. We tokenize eagerly so the structural markers keep
their special-token ids while user- and tool-supplied text stays ordinary.
Source code in vllm/renderers/kimi_k3.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
_normalize_k3_tool_messages(conversation)
¶
Reorder tool-result messages to match assistant tool_call order.
Supports matching by tool_call_id or by the synthetic
"{tool}:{zero_based_index}" alias. When any tool message in a
block cannot be resolved, the whole block is left in its original
order (graceful fallback).
Returns a new list; caller-owned message dicts are not mutated.