def _remove_value_at_path(
        self, data: Dict[str, Any], path_parts: List[Union[str, int]]
    ) -> None:
        """Remove value at the specified path."""
        if not path_parts:
            raise ValueError("Cannot remove root")

        current = data
        for part in path_parts[:-1]:
            if isinstance(current, dict):
                if part not in current:
                    raise KeyError(f"Key '{part}' not found")
                current = current[part]
            elif isinstance(current, list):
                if not isinstance(part, int):
                    raise ValueError(f"Array index must be integer, got {part}")
                if part >= len(current) or part < -len(current):
                    raise IndexError(f"Array index {part} out of range")
                current = current[part]
            else:
                raise ValueError(
                    f"Cannot index into {type(current).__name__} with {part}"
                )

        last_part = path_parts[-1]
        if isinstance(current, dict):
            if last_part not in current:
                raise KeyError(f"Key '{last_part}' not found")
            del current[last_part]
        elif isinstance(current, list):
            if not isinstance(last_part, int):
                raise ValueError(f"Array index must be integer, got {last_part}")
            if last_part >= len(current) or last_part < -len(current):
                raise IndexError(f"Array index {last_part} out of range")
            del current[last_part]
        else:
            raise ValueError(f"Cannot remove value from {type(current).__name__}")
Remove value at the specified path.
llama-index-integrations/tools/llama-index-tools-artifact-editor/llama_index/tools/artifact_editor/base.py