vllm.tokenizers.deepseek_v32_encoding ¶
TOOLS_SYSTEM_TEMPLATE module-attribute ¶
TOOLS_SYSTEM_TEMPLATE = '## Tools\nYou have access to a set of tools you can use to answer the user\'s question.\nYou can invoke functions by writing a "<{dsml_token}function_calls>" block like the following as part of your reply to the user:\n<{dsml_token}function_calls>\n<{dsml_token}invoke name="$FUNCTION_NAME">\n<{dsml_token}parameter name="$PARAMETER_NAME" string="true|false">$PARAMETER_VALUE</{dsml_token}parameter>\n...\n</{dsml_token}invoke>\n<{dsml_token}invoke name="$FUNCTION_NAME2">\n...\n</{dsml_token}invoke>\n</{dsml_token}function_calls>\nString and scalar parameters should be specified as is without any escaping or quotes, while lists and objects should use JSON format. The "string" attribute should be set to "true" for string type parameters and "false" for other types (numbers, booleans, arrays, objects).\nIf the thinking_mode is enabled, then after function results you should strongly consider outputting a thinking block. Here is an example:\n<{dsml_token}function_calls>\n...\n</{dsml_token}function_calls>\n<function_results>\n...\n</function_results>\n{thinking_start_token}...thinking about results{thinking_end_token}\nHere are the functions available in JSONSchema format:\n<functions>\n{tool_schemas}\n</functions>\n'
assistant_msg_template module-attribute ¶
assistant_msg_template: str = (
"{reasoning}{content}{tool_calls}<|end▁of▁sentence|>"
)
response_format_template module-attribute ¶
response_format_template: str = "## Response Format:\n\nYou MUST strictly adhere to the following schema to reply:\n{schema}"
tool_call_template module-attribute ¶
tool_call_template: str = '<{dsml_token}invoke name="{name}">\n{arguments}\n</{dsml_token}invoke>'
tool_calls_template module-attribute ¶
_read_until_stop ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
decode_dsml_to_arguments ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
drop_thinking_messages ¶
drop_thinking_messages(
messages: list[dict[str, Any]],
last_user_idx: int | None = None,
) -> list[dict[str, Any]]
Source code in vllm/tokenizers/deepseek_v32_encoding.py
encode_arguments_to_dsml ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
encode_messages ¶
encode_messages(
messages: list[dict[str, Any]],
thinking_mode: str,
context: list[dict[str, Any]] | None = None,
drop_thinking: bool = True,
add_default_bos_token: bool = True,
) -> str
Source code in vllm/tokenizers/deepseek_v32_encoding.py
find_last_user_index ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
parse_message_from_completion_text ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
parse_tool_calls ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
render_message ¶
Source code in vllm/tokenizers/deepseek_v32_encoding.py
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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |