vllm.renderers.inkling_encoding
¶
Inkling chat-encoding core.
Pure implementation of Inkling chat rendering, kept deliberately free of
vLLM imports: it depends only on the InklingTextTokenizer protocol
and speaks OpenAI-style message dicts. If a standalone Inkling
input-processing library becomes available, this module is the unit to
swap out — the swap point is marked in vllm/renderers/inkling.py.
Multimodal parts follow the contract of vLLM's Inkling multimodal processor
(InklingMultiModalProcessor anchors prompt updates on the bare
content-kind marker and inserts the per-patch placeholder run itself):
- image parts emit only
<|content_image|>— no seed placeholder id; - audio parts emit
<|content_audio_input|><|audio_end|>— no seed placeholder id between them.
reasoning_effort (a float in [0, 0.99], sourced from
chat_template_kwargs only) renders the Thinking effort level:
system control block after the tool declarations and initial system messages.
Classes:
-
InklingTextTokenizer–Structural tokenizer contract required by the renderer.
Functions:
-
continuation_prefix–Return the text an Inkling2
continue_final_messagerequest extends. -
render_inkling2_messages–Render chat messages to Inkling2 input ids.
-
render_inkling_messages–Render chat messages to Inkling input ids.
InklingTextTokenizer
¶
Bases: Protocol
Structural tokenizer contract required by the renderer.
Source code in vllm/renderers/inkling_encoding.py
_collect_tools(messages, tools)
¶
Request-level plus per-developer-message tools (Rust renderer semantics), declared in a single leading system block.
Source code in vllm/renderers/inkling_encoding.py
_flatten_text_content(content)
¶
Flatten a tool-response content (string or text parts) to text.
Source code in vllm/renderers/inkling_encoding.py
_iter_render_parts(content)
¶
Yield (kind, text) per content part: kind in {text, image, audio}.
Source code in vllm/renderers/inkling_encoding.py
_tml_json_dumps(value, *, legacy_floats=True, sort_keys=True)
¶
Compact JSON with the Inkling2 reference float spelling.
Source code in vllm/renderers/inkling_encoding.py
_tml_json_loads(text)
¶
Parse JSON as the Inkling2 reference does (64-bit ints, finite floats).
Source code in vllm/renderers/inkling_encoding.py
continuation_prefix(message)
¶
Return the text an Inkling2 continue_final_message request extends.
Only a plain-string assistant message with no tool calls or reasoning is
continued; None means the message renders as a closed turn.
Source code in vllm/renderers/inkling_encoding.py
render_inkling2_messages(messages, tokenizer, *, tools=None, tool_choice=None, parallel_tool_calls=True, reasoning_effort=DEFAULT_REASONING_EFFORT, continue_final_message=False)
¶
Render chat messages to Inkling2 input ids.
With continue_final_message, a final assistant message holding only
a text string is left open so generation continues its text.
Source code in vllm/renderers/inkling_encoding.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 | |
render_inkling_messages(messages, tokenizer, *, add_generation_prompt=True, tools=None, reasoning_effort=None)
¶
Render chat messages to Inkling input ids.
PURE renderer: emits Inkling framing plus bare media markers; media
encoding and placeholder expansion happen later in the MM processor.
add_generation_prompt appends the assistant turn opener so the
model continues into the response.
Source code in vllm/renderers/inkling_encoding.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 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 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |