embedding=embedding, limit=k, metadata=metadata, **kwargs
        )
        return [
            Document(
                page_content=doc.content,
                metadata=doc.metadata,
            )
            for doc in results
        ]
    def _max_marginal_relevance_selection(
        self,
        query_vector: List[float],
        results: List["ZepDocument"],
        *,
        lambda_mult: float = 0.5,
        k: int = 4,
    ) -> List[Document]:
        mmr_selected = maximal_marginal_relevance(
            np.array([query_vector], dtype=np.float32),
            [d.embedding for d in results],
            lambda_mult=lambda_mult,
            k=k,
        )
        selected = [results[i] for i in mmr_selected]
        return [Document(page_content=d.content, metadata=d.metadata) for d in selected]
[docs]    def max_marginal_relevance_search(
        self,
        query: str,
        k: int = 4,
        fetch_k: int = 20,
        lambda_mult: float = 0.5,
        metadata: Optional[Dict[str, Any]] = None,
        **kwargs: Any,
    ) -> List[Document]:
        """Return docs selected using the maximal marginal relevance.
        Maximal marginal relevance optimizes for similarity to query AND diversity
        among selected documents.
        Args:
            query: Text to look up documents similar to.
            k: Number of Documents to return. Defaults to 4.
            fetch_k: Number of Documents to fetch to pass to MMR algorithm.
            lambda_mult: Number between 0 and 1 that determines the degree
                        of diversity among the results with 0 corresponding