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
- Python SDK
- TypeScript SDK
datasets = client.list_datasets()
const datasets = await client.listDatasets();
List datasets by name
If you want to search by the exact name, you can do the following:
- Python SDK
- TypeScript SDK
datasets = client.list_datasets(dataset_name="My Test Dataset 1")
const datasets = await client.listDatasets({datasetName: "My Test Dataset 1"});
If you want do do a case-invariant substring search, try the following:
- Python SDK
- TypeScript SDK
datasets = client.list_datasets(dataset_name_contains="some substring")
const datasets = await client.listDatasets({datasetNameContains: "some substring"});
List datasets by type
You can filter datasets by type. Below is an example querying for chat datasets.
- Python SDK
- TypeScript SDK
datasets = client.list_datasets(data_type="chat")
const datasets = await client.listDatasets({dataType: "chat"});