From 80141f14752f47131f96ec0e0ac1963d4206f41b Mon Sep 17 00:00:00 2001 From: mspronesti Date: Tue, 5 Sep 2023 23:35:22 +0200 Subject: [PATCH] feat(llm): deprecate falcon and starcoder --- pandasai/llm/falcon.py | 17 +++++++++++------ pandasai/llm/starcoder.py | 11 ++++++++++- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/pandasai/llm/falcon.py b/pandasai/llm/falcon.py index 9fabd01c3..a504871b0 100644 --- a/pandasai/llm/falcon.py +++ b/pandasai/llm/falcon.py @@ -12,17 +12,13 @@ from ..helpers import load_dotenv from .base import HuggingFaceLLM +import warnings load_dotenv() class Falcon(HuggingFaceLLM): - - """Falcon LLM API - - A base HuggingFaceLLM class is extended to use Falcon model. - - """ + """Falcon LLM API (Deprecated: Kept for backwards compatibility)""" api_token: str _api_url: str = ( @@ -30,6 +26,15 @@ class Falcon(HuggingFaceLLM): ) _max_retries: int = 30 + def __init__(self, **kwargs): + warnings.warn( + """Falcon is deprecated and will be removed in a future release. + Please use langchain.llms.HuggingFaceHub instead, although please be + aware that it may perform poorly. + """ + ) + super().__init__(**kwargs) + @property def type(self) -> str: return "falcon" diff --git a/pandasai/llm/starcoder.py b/pandasai/llm/starcoder.py index 3546116c1..bc0f98e85 100644 --- a/pandasai/llm/starcoder.py +++ b/pandasai/llm/starcoder.py @@ -8,7 +8,7 @@ >>> from pandasai.llm.starcoder import Starcoder """ - +import warnings from ..helpers import load_dotenv from .base import HuggingFaceLLM @@ -28,6 +28,15 @@ class Starcoder(HuggingFaceLLM): _api_url: str = "https://api-inference.huggingface.co/models/bigcode/starcoder" _max_retries: int = 30 + def __init__(self, **kwargs): + warnings.warn( + """Starcoder is deprecated and will be removed in a future release. + Please use langchain.llms.HuggingFaceHub instead, although please be + aware that it may perform poorly. + """ + ) + super().__init__(**kwargs) + @property def type(self) -> str: return "starcoder"