def add_chunks(self, chunks, batch_size=16):
        """Filter chunks and add them to the vector store."""
        filtered_chunks = filter_complex_metadata(chunks)
        documents = []
        metadatas = []
        ids = []
        for chunk in filtered_chunks:
            # Assuming each chunk has .page_content and .metadata attributes
            documents.append(chunk.page_content)
            metadatas.append(chunk.metadata)
            ids.append(str(uuid.uuid4()))

        embeddings = []
        # Process documents in batches to avoid memory issues
        for i in range(0, len(documents), batch_size):
            batch_texts = documents[i:i+batch_size]
            batch_embeddings = self.embeddings.embed_documents(batch_texts)
            embeddings.extend(batch_embeddings)

        self.collection.add(documents=documents, metadatas=metadatas, ids=ids, embeddings=embeddings)
Filter chunks and add them to the vector store.
examples/expositional/use_cases/snowflake-ai-stack/src/retrieval.py