langsmith.client.Client.read_dataset_version#
- Client.read_dataset_version(*, dataset_id: UUID | str | None = None, dataset_name: str | None = None, as_of: datetime | None = None, tag: str | None = None) DatasetVersion[source]#
Get dataset version by as_of or exact tag.
Ues this to resolve the nearest version to a given timestamp or for a given tag.
- Parameters:
dataset_id (Optional[ID_TYPE]) – The ID of the dataset.
dataset_name (Optional[str]) – The name of the dataset.
as_of (Optional[datetime.datetime]) – The timestamp of the dataset to retrieve.
tag (Optional[str]) – The tag of the dataset to retrieve.
- Returns:
The dataset version.
- Return type:
ls_schemas.DatasetVersion
Examples:#
# Get the latest version of a dataset client.read_dataset_version(dataset_name="my-dataset", tag="latest") # Get the version of a dataset <= a given timestamp client.read_dataset_version( dataset_name="my-dataset", as_of=datetime.datetime(2024, 1, 1), ) # Get the version of a dataset with a specific tag client.read_dataset_version(dataset_name="my-dataset", tag="prod")