Skip to main content

How to list datasets from the client

You can programmatically fetch the datasets from LangSmith using the list_datasets method in the client. Below are some common examples:

Query all datasets

datasets = client.list_datasets()

List datasets by name

If you want to search by the exact name, you can do the following:

datasets = client.list_datasets(dataset_name="My Test Dataset 1")

If you want do do a case-invariant substring search, try the following:

datasets = client.list_datasets(dataset_name_contains="some substring")

List datasets by type

You can filter datasets by type. Below is an example querying for chat datasets.

datasets = client.list_datasets(data_type="chat")

Help us out by providing feedback on this documentation page: