diff --git a/phi/file/file.py b/phi/file/file.py index dc479f1c3..5fe7ab178 100644 --- a/phi/file/file.py +++ b/phi/file/file.py @@ -4,7 +4,7 @@ class File(BaseModel): - name: str + name: Optional[str] = None description: Optional[str] = None columns: Optional[List[str]] = None path: Optional[str] = None diff --git a/phi/file/local/csv.py b/phi/file/local/csv.py index efc54e843..d13e3dc2e 100644 --- a/phi/file/local/csv.py +++ b/phi/file/local/csv.py @@ -9,6 +9,11 @@ class CsvFile(File): type: str = "CSV" def get_metadata(self) -> dict[str, Any]: + if self.name is None: + from pathlib import Path + + self.name = Path(self.path).name + if self.columns is None: try: # Get the columns from the file diff --git a/pyproject.toml b/pyproject.toml index 5e1087fab..d76157729 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "phidata" -version = "2.1.0" +version = "2.1.1" description = "AI Toolkit for Engineers" requires-python = ">=3.7" readme = "README.md"