async def setup_collection(self, vector_size: int) -> None:  # noqa: C901
        """Set up the Qdrant collection for storing entities.

        Args:
            vector_size (int): The size of the vectors to use.
        """
        await self.ensure_client_readiness()

        try:
            # Check if collection exists
            if await self.collection_exists(self.collection_name):
                logger.info(f"Collection {self.collection_name} already exists.")
                return

            logger.info(f"Creating collection {self.collection_name}...")

            # Create the collection
            await self.client.create_collection(
                collection_name=self.collection_name,
                vectors_config=rest.VectorParams(
                    size=vector_size if vector_size else self.vector_size,
                    distance=rest.Distance.COSINE,
                ),
                optimizers_config=rest.OptimizersConfigDiff(
                    indexing_threshold=20000,  # Default indexing threshold
                ),
                on_disk_payload=True,  # Store payload on disk to save memory
            )

        except Exception as e:
            if "already exists" not in str(e):
                raise
Set up the Qdrant collection for storing entities.

        Args:
            vector_size (int): The size of the vectors to use.
        
backend/airweave/platform/destinations/qdrant.py