from typing import Dict def is_legacy_structural_tag(obj: Dict) -> bool: # test whether an object is a legacy structural tag # see `StructuralTagResponseFormat` at `sglang.srt.entrypoints.openai.protocol` if obj.get("structures", None) is not None: assert obj.get("triggers", None) is not None return True else: assert obj.get("format", None) is not None return False