Draft

Exploring automated policy review using AI

Author

Erik LaBianca

Published

January 30, 2025

Let’s see if we can automatically review content for policy compliance.

POLICY="""
Do no evil.
"""
import pathlib

html_content = pathlib.Path('example.html').read_text()
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[2], line 3
      1 import pathlib
----> 3 html_content = pathlib.Path('example.html').read_text()
File /opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/pathlib/_local.py:546, in Path.read_text(self, encoding, errors, newline)
    543 # Call io.text_encoding() here to ensure any warning is raised at an
    544 # appropriate stack level.
    545 encoding = io.text_encoding(encoding)
--> 546 return PathBase.read_text(self, encoding, errors, newline)
File /opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/pathlib/_abc.py:632, in PathBase.read_text(self, encoding, errors, newline)
    628 def read_text(self, encoding=None, errors=None, newline=None):
    629     """
    630     Open the file in text mode, read it, and close the file.
    631     """
--> 632     with self.open(mode='r', encoding=encoding, errors=errors, newline=newline) as f:
    633         return f.read()
File /opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/pathlib/_local.py:537, in Path.open(self, mode, buffering, encoding, errors, newline)
    535 if "b" not in mode:
    536     encoding = io.text_encoding(encoding)
--> 537 return io.open(self, mode, buffering, encoding, errors, newline)
FileNotFoundError: [Errno 2] No such file or directory: 'example.html'