Home / Function/ load_dataset() — langchain Function Reference

load_dataset() — langchain Function Reference

Architecture documentation for the load_dataset() function in loading.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  789791c5_f645_4400_653b_361cb0479dc0["load_dataset()"]
  1183e0f4_44a5_0674_c4b1_e5f99e15eda8["loading.py"]
  789791c5_f645_4400_653b_361cb0479dc0 -->|defined in| 1183e0f4_44a5_0674_c4b1_e5f99e15eda8
  style 789791c5_f645_4400_653b_361cb0479dc0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/evaluation/loading.py lines 52–85

def load_dataset(uri: str) -> list[dict]:
    """Load a dataset from the [LangChainDatasets on HuggingFace](https://huggingface.co/LangChainDatasets).

    Args:
        uri: The uri of the dataset to load.

    Returns:
        A list of dictionaries, each representing a row in the dataset.

    **Prerequisites**

    ```bash
    pip install datasets
    ```

    Examples:
    --------
    ```python
    from langchain_classic.evaluation import load_dataset

    ds = load_dataset("llm-math")
    ```
    """
    try:
        from datasets import load_dataset
    except ImportError as e:
        msg = (
            "load_dataset requires the `datasets` package."
            " Please install with `pip install datasets`"
        )
        raise ImportError(msg) from e

    dataset = load_dataset(f"LangChainDatasets/{uri}")
    return list(dataset["train"])

Domain

Subdomains

Frequently Asked Questions

What does load_dataset() do?
load_dataset() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/evaluation/loading.py.
Where is load_dataset() defined?
load_dataset() is defined in libs/langchain/langchain_classic/evaluation/loading.py at line 52.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free