Using absolute paths to our internal files is probably not a good way to find their Workspace Root.
def add_model_to_file(model: str, file_path: str = "model.py") -> str:
"""Add the Pydantic Model string to a Python file.
Args:
model: The Pydantic Model string.
file_path: The path must include the .py file extension.
"""
root = os.path.join(os.path.dirname(__file__), "../")
fp = os.path.join(root, file_path)
with open(fp, "a") as f:
f.write(model)
return f
Using absolute paths to our internal files is probably not a good way to find their Workspace Root.