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 :class: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:
-
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
_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
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
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 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 | |