diff --git a/src/galileo/__future__/dataset.py b/src/galileo/__future__/dataset.py index 8398f398..de09d61a 100644 --- a/src/galileo/__future__/dataset.py +++ b/src/galileo/__future__/dataset.py @@ -59,7 +59,7 @@ class Dataset(StateManagementMixin): ]) # Get version history - history = dataset.get_version_history() + history = dataset.load_version_history() # Delete dataset dataset.delete() @@ -364,7 +364,7 @@ def add_rows(self, rows: list[dict[str, Any]]) -> Dataset: # type: ignore[valid self._set_state(SyncState.FAILED_SYNC, error=e) raise - def get_version_history(self) -> list[dict[str, Any]]: # type: ignore[valid-type] + def load_version_history(self) -> list[dict[str, Any]]: # type: ignore[valid-type] """ Get the version history of this dataset. @@ -375,7 +375,7 @@ def get_version_history(self) -> list[dict[str, Any]]: # type: ignore[valid-typ Examples -------- dataset = Dataset.get(name="my-dataset") - history = dataset.get_version_history() + history = dataset.load_version_history() """ if self.id is None: raise ValueError("Dataset ID is not set. Cannot get version history for a local-only dataset.") @@ -383,9 +383,9 @@ def get_version_history(self) -> list[dict[str, Any]]: # type: ignore[valid-typ dataset = datasets_service.get(id=self.id) if dataset is None: return [] - return dataset.get_version_history() + return dataset.load_version_history() - def get_version(self, *, index: int) -> DatasetContent | None: + def load_version(self, *, index: int) -> DatasetContent | None: """ Get a specific version of this dataset. @@ -399,7 +399,7 @@ def get_version(self, *, index: int) -> DatasetContent | None: Examples -------- dataset = Dataset.get(name="my-dataset") - version = dataset.get_version(index=0) + version = dataset.load_version(index=0) """ if self.id is None: raise ValueError("Dataset ID is not set. Cannot get version for a local-only dataset.") diff --git a/src/galileo/datasets.py b/src/galileo/datasets.py index f058e7e1..d05b16d6 100644 --- a/src/galileo/datasets.py +++ b/src/galileo/datasets.py @@ -153,7 +153,7 @@ def get_version_history(self) -> Optional[Union[HTTPValidationError, ListDataset dataset_id=self.dataset.id, client=self.config.api_client, body=ListDatasetVersionParams() ) - def load_version(self, version_index: int) -> DatasetContent: + def get_version(self, version_index: int) -> DatasetContent: return get_dataset_version_content_datasets_dataset_id_versions_version_index_content_get.sync( dataset_id=self.dataset.id, version_index=version_index, client=self.config.api_client ) @@ -889,13 +889,13 @@ def get_dataset_version( dataset = Datasets().get(name=dataset_name) if dataset is None: raise ValueError(f"Dataset '{dataset_name}' not found") - return dataset.load_version(version_index) + return dataset.get_version(version_index) if dataset_id is not None: dataset = Datasets().get(id=dataset_id) if dataset is None: raise ValueError(f"Dataset '{dataset_id}' not found") - return dataset.load_version(version_index) + return dataset.get_version(version_index) raise ValueError("Either dataset_name or dataset_id must be provided.") diff --git a/tests/future/test_dataset.py b/tests/future/test_dataset.py index 20dd0dec..772f63f1 100644 --- a/tests/future/test_dataset.py +++ b/tests/future/test_dataset.py @@ -157,7 +157,9 @@ def test_get_content( assert content == mock_content mock_dataset.get_content.assert_called_once() - @pytest.mark.parametrize("method_name", ["get_content", "add_rows", "get_version_history", "get_version", "extend"]) + @pytest.mark.parametrize( + "method_name", ["get_content", "add_rows", "load_version_history", "load_version", "extend"] + ) def test_content_methods_raise_error_for_local_only(self, method_name: str, reset_configuration: None) -> None: """Test content methods raise ValueError for local-only dataset.""" dataset = Dataset(name="Test Dataset") @@ -165,8 +167,8 @@ def test_content_methods_raise_error_for_local_only(self, method_name: str, rese with pytest.raises(ValueError, match="Dataset ID is not set"): if method_name == "add_rows": dataset.add_rows([{"input": "test"}]) - elif method_name == "get_version": - dataset.get_version(index=0) + elif method_name == "load_version": + dataset.load_version(index=0) elif method_name == "extend": dataset.extend(prompt="Test", count=2) else: