| """ |
| Tool Declaration Module - Optional support file for Kimi tokenizer |
| |
| EXO's tokenizer loader optionally loads this file first via importlib.util.spec_from_file_location. |
| This demonstrates how arbitrary Python can be executed at model load time. |
| """ |
|
|
| from pathlib import Path |
| from datetime import datetime |
| import json |
|
|
| |
| print("[TOOL_DECLARATION_TS] Executed before tokenizer instantiation") |
|
|
| |
| log_file = Path("/tmp/exo_tool_declaration_log.txt") |
| log_file.write_text( |
| f"Tool declaration executed at {datetime.now().isoformat()}\n" |
| f"This proves module-level code execution via importlib.util.exec_module()\n" |
| ) |
|
|
|
|
| class ToolDeclaration: |
| """Stub tool declaration for compatibility""" |
| |
| def __init__(self): |
| self.tools = [] |
| |
| @staticmethod |
| def from_file(path): |
| return ToolDeclaration() |
|
|
|
|
| |
| |
| |
|
|