def from_rag_evaluation(
        cls,
        index: BaseIndex,
        benchmark_df: pd.DataFrame,
        rag_dataset: "LabelledRagDataset",
        name: str,
        baseline_name: str,
        description: str,
        source_urls: Optional[List[str]] = None,
        code_url: Optional[str] = None,
    ) -> "DatasetCard":
        """
        Convenience constructor method for building a DatasetCard.

        Args:
            index (BaseIndex): the index from which query_engine is derived and
                used in the rag evaluation.
            benchmark_df (pd.DataFrame): the benchmark dataframe after using
                RagEvaluatorPack
            rag_dataset (LabelledRagDataset): the LabelledRagDataset used for
                evaluations
            name (str): The name of the new dataset e.g., "Paul Graham Essay Dataset"
            baseline_name (str): The name of the baseline e.g., "llamaindex"
            description (str): The description of the new dataset.
            source_urls (Optional[List[str]], optional): _description_. Defaults to None.
            code_url (Optional[str], optional): _description_. Defaults to None.

        Returns:
            DatasetCard

        """
        # extract metadata from rag_dataset
        num_observations = len(rag_dataset.examples)
        contains_examples_by_humans = any(
            (el.query_by.type == "human" or el.reference_answer_by.type == "human")
            for el in rag_dataset.examples
        )
        contains_examples_by_ai = any(
            (el.query_by.type == "ai" or el.reference_answer_by.type == "ai")
            for el in rag_dataset.examples
        )

        # extract baseline config info from index
        llm = Settings.llm.metadata.model_name
        embed_model = Settings.embed_model.model_name
        chunk_size = index._transformations[0].chunk_size
        similarity_top_k = index.as_retriever()._similarity_top_k
        baseline_config = BaselineConfig(
            llm=llm,
            chunk_size=chunk_size,
            similarity_top_k=similarity_top_k,
            embed_model=embed_model,
        )

        # extract baseline metrics from benchmark_df
        baseline_metrics = BaselineMetrics(
            correctness=cls._format_metric(
                benchmark_df.T["mean_correctness_score"].values[0]
            ),
            relevancy=cls._format_metric(
                benchmark_df.T["mean_relevancy_score"].values[0]
            ),
            faithfulness=cls._format_metric(
                benchmark_df.T["mean_faithfulness_score"].values[0]
            ),
            context_similarity=cls._format_metric(
                benchmark_df.T["mean_context_similarity_score"].values[0]
            ),
        )

        # baseline
        if code_url is None:
            code_url = ""
        baseline = Baseline(
            name=baseline_name,
            config=baseline_config,
            metrics=baseline_metrics,
            code_url=code_url,
        )

        if source_urls is None:
            source_urls = []

        return cls(
            name=name,
            description=description,
            source_urls=source_urls,
            number_observations=num_observations,
            contains_examples_by_humans=contains_examples_by_humans,
            contains_examples_by_ai=contains_examples_by_ai,
            baselines=[baseline],
        )

        Convenience constructor method for building a DatasetCard.

        Args:
            index (BaseIndex): the index from which query_engine is derived and
                used in the rag evaluation.
            benchmark_df (pd.DataFrame): the benchmark dataframe after using
                RagEvaluatorPack
            rag_dataset (LabelledRagDataset): the LabelledRagDataset used for
                evaluations
            name (str): The name of the new dataset e.g., "Paul Graham Essay Dataset"
            baseline_name (str): The name of the baseline e.g., "llamaindex"
            description (str): The description of the new dataset.
            source_urls (Optional[List[str]], optional): _description_. Defaults to None.
            code_url (Optional[str], optional): _description_. Defaults to None.

        Returns:
            DatasetCard

        
llama-index-packs/llama-index-packs-llama-dataset-metadata/llama_index/packs/llama_dataset_metadata/base.py