diff --git a/assets/prompt-templates/correct_error_prompt.tmpl b/pandasai/assets/prompt-templates/correct_error_prompt.tmpl similarity index 100% rename from assets/prompt-templates/correct_error_prompt.tmpl rename to pandasai/assets/prompt-templates/correct_error_prompt.tmpl diff --git a/assets/prompt-templates/generate_python_code.tmpl b/pandasai/assets/prompt-templates/generate_python_code.tmpl similarity index 100% rename from assets/prompt-templates/generate_python_code.tmpl rename to pandasai/assets/prompt-templates/generate_python_code.tmpl diff --git a/pandasai/prompts/base.py b/pandasai/prompts/base.py index ba44a62f2..6dcf513bf 100644 --- a/pandasai/prompts/base.py +++ b/pandasai/prompts/base.py @@ -2,6 +2,8 @@ In order to better handle the instructions, this prompt module is written. """ from abc import ABC, abstractmethod +import os +from pathlib import Path from ..exceptions import TemplateFileNotFoundError @@ -77,6 +79,11 @@ class FileBasedPrompt(AbstractPrompt): def __init__(self, **kwargs): if (template_path := kwargs.pop("path_to_template", None)) is not None: self._path_to_template = template_path + else: + current_dir_path = Path(__file__).parent + self._path_to_template = os.path.join( + current_dir_path, "..", self._path_to_template + ) super().__init__(**kwargs)