Skip to content

Commit

Permalink
fix: type hint for property last_prompt_id
Browse files Browse the repository at this point in the history
* (fix): make type hint for the property `.last_prompt_id` to be
  `uuid.UUID` rather than `str`
  • Loading branch information
nautics889 committed Nov 13, 2023
1 parent 0712f84 commit 89ae88d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pandasai/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"""
import warnings
from typing import List, Optional, Union, Dict, Type
import uuid
import importlib.metadata

import pandas as pd
Expand Down Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion pandasai/smart_dataframe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""

import hashlib
import uuid
from io import StringIO

import pandas as pd
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pandasai/smart_datalake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 89ae88d

Please sign in to comment.