async def update_entity(
            collection_id: UUID = Path(
                ...,
                description="The collection ID corresponding to the graph containing the entity.",
            ),
            entity_id: UUID = Path(
                ..., description="The ID of the entity to update."
            ),
            name: Optional[str] = Body(
                ..., description="The updated name of the entity."
            ),
            description: Optional[str] = Body(
                None, description="The updated description of the entity."
            ),
            category: Optional[str] = Body(
                None, description="The updated category of the entity."
            ),
            metadata: Optional[dict] = Body(
                None, description="The updated metadata of the entity."
            ),
            auth_user=Depends(self.providers.auth.auth_wrapper()),
        ) -> WrappedEntityResponse:
            """Updates an existing entity in the graph."""
            if not auth_user.is_superuser:
                raise R2RException(
                    "Only superusers can update graph entities.", 403
                )
            if (
                # not auth_user.is_superuser
                collection_id not in auth_user.collection_ids
            ):
                raise R2RException(
                    "The currently authenticated user does not have access to the collection associated with the given graph.",
                    403,
                )

            return await self.services.graph.update_entity(  # type: ignore
                entity_id=entity_id,
                name=name,
                category=category,
                description=description,
                metadata=metadata,
            )
Updates an existing entity in the graph.
py/core/main/api/v3/graph_router.py