def test_set_invalid_field_path(editor: ArtifactEditorToolSpec):
    """Test setting a field that doesn't exist in the Pydantic model schema."""
    editor.create_artifact(name="John", age=30)

    # Try to add a field that doesn't exist in the Person model
    patch = JsonPatch(
        operations=[PatchOperation(op="add", path="/invalid_field", value="test")]
    )

    # This should raise an error since invalid_field is not in the Person model
    with pytest.raises(ValueError, match="Invalid field 'invalid_field'"):
        editor.apply_patch(patch)
Test setting a field that doesn't exist in the Pydantic model schema.
llama-index-integrations/tools/llama-index-tools-artifact-editor/tests/test_artifact_editor.py