async def _generate_drive_item_entities(
        self, client: httpx.AsyncClient, drive_id: str, drive_name: str
    ) -> AsyncGenerator[ChunkEntity, None]:
        """Generate OneDriveDriveItemEntity objects for files in the drive."""
        file_count = 0
        async for item in self._list_all_drive_items_recursively(client, drive_id):
            try:
                # Skip folders early
                if "folder" in item:
                    continue

                # Fetch the individual item to get download URL
                download_url = await self._get_download_url(client, drive_id, item["id"])

                # Build the entity with the download URL
                file_entity = self._build_file_entity(item, drive_name, drive_id, download_url)

                if not file_entity:
                    continue

                # Process the file entity (download and process content)
                if file_entity.download_url:
                    processed_entity = await self.process_file_entity(
                        file_entity=file_entity, access_token=self.access_token
                    )
                    if processed_entity:
                        yield processed_entity
                        file_count += 1
                        logger.info(f"Processed file {file_count}: {file_entity.name}")
                else:
                    logger.warning(f"No download URL available for {file_entity.name}")

            except Exception as e:
                logger.error(f"Failed to process item {item.get('name', 'unknown')}: {str(e)}")
                # Continue processing other items
                continue

        logger.info(f"Total files processed: {file_count}")
Generate OneDriveDriveItemEntity objects for files in the drive.
backend/airweave/platform/sources/onedrive.py