From 30c70ca3e6766ce500d98adfecbadc772107c092 Mon Sep 17 00:00:00 2001 From: Ihor <31508183+nautics889@users.noreply.github.com> Date: Wed, 15 Nov 2023 12:07:01 +0200 Subject: [PATCH] fix: type hint for property `last_prompt_id` (#750) * (fix): make type hint for the property `.last_prompt_id` to be `uuid.UUID` rather than `str` --- pandasai/__init__.py | 3 ++- pandasai/smart_dataframe/__init__.py | 3 ++- pandasai/smart_datalake/__init__.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pandasai/__init__.py b/pandasai/__init__.py index 57a5de023..10fab32e2 100644 --- a/pandasai/__init__.py +++ b/pandasai/__init__.py @@ -35,6 +35,7 @@ """ import warnings from typing import List, Optional, Union, Dict, Type +import uuid import importlib.metadata import pandas as pd @@ -236,7 +237,7 @@ def logs(self) -> List[dict[str, str]]: return [] if self._dl is None else self._dl.logs @property - def last_prompt_id(self) -> str: + def last_prompt_id(self) -> uuid.UUID: """Return the id of the last prompt that was run.""" return None if self._dl is None else self._dl.last_prompt_id diff --git a/pandasai/smart_dataframe/__init__.py b/pandasai/smart_dataframe/__init__.py index aabeeed34..6f504f5bb 100644 --- a/pandasai/smart_dataframe/__init__.py +++ b/pandasai/smart_dataframe/__init__.py @@ -19,6 +19,7 @@ """ import hashlib +import uuid from io import StringIO import pandas as pd @@ -538,7 +539,7 @@ def last_prompt(self): return self.lake.last_prompt @property - def last_prompt_id(self) -> str: + def last_prompt_id(self) -> uuid.UUID: return self.lake.last_prompt_id @property diff --git a/pandasai/smart_datalake/__init__.py b/pandasai/smart_datalake/__init__.py index ca21466e8..e16170636 100644 --- a/pandasai/smart_datalake/__init__.py +++ b/pandasai/smart_datalake/__init__.py @@ -582,7 +582,7 @@ def last_prompt(self): return self._llm.last_prompt @property - def last_prompt_id(self) -> str: + def last_prompt_id(self) -> uuid.UUID: """Return the id of the last prompt that was run.""" if self._last_prompt_id is None: raise ValueError("Pandas AI has not been run yet.")