Download TeleChat3-Coder_vllm_tool_parser/telechat3_reasoning.py from Tele-AI/TeleChat3-Coder-36B-Thinking: direct link, hf CLI and curl.
- Browser
- Download file 992 Bytes
-
https://huggingface.co/Tele-AI/TeleChat3-Coder-36B-Thinking/resolve/main/TeleChat3-Coder_vllm_tool_parser/telechat3_reasoning.py
- Command line
-
hf download hf://Tele-AI/TeleChat3-Coder-36B-Thinking/TeleChat3-Coder_vllm_tool_parser/telechat3_reasoning.py
-
curl -L -o telechat3_reasoning.py https://huggingface.co/Tele-AI/TeleChat3-Coder-36B-Thinking/resolve/main/TeleChat3-Coder_vllm_tool_parser/telechat3_reasoning.py
992 Bytes
| import vllm | |
| from vllm.entrypoints.chat_utils import ( | |
| ChatCompletionMessageParam, | |
| ConversationMessage, | |
| BaseMultiModalItemTracker, | |
| _ChatTemplateContentFormat, | |
| _parse_chat_message_content, | |
| ) | |
| from vllm.logger import init_logger | |
| logger = init_logger(__name__) | |
| def _telechat3_parse_chat_message_content( | |
| message: ChatCompletionMessageParam, | |
| mm_tracker: BaseMultiModalItemTracker, | |
| content_format: _ChatTemplateContentFormat, | |
| ) -> list[ConversationMessage]: | |
| result = _parse_chat_message_content(message, mm_tracker, content_format) | |
| reasoning_content = message.get("reasoning_content") | |
| if len(result) > 0 and reasoning_content: | |
| logger.info("add reasoning content to input prompt.") | |
| result[0].update({"reasoning_content": reasoning_content}) | |
| return result | |
| def register_reasoning(): | |
| vllm.entrypoints.chat_utils._parse_chat_message_content = ( | |
| _telechat3_parse_chat_message_content | |
| ) | |