Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate Falcon and Starcoder #530

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions pandasai/llm/falcon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

>>> from pandasai.llm.falcon import Falcon
"""

import warnings

from ..helpers import load_dotenv
from .base import HuggingFaceLLM
Expand All @@ -17,19 +17,23 @@


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 = (
"https://api-inference.huggingface.co/models/tiiuae/falcon-7b-instruct"
)
_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"
17 changes: 11 additions & 6 deletions pandasai/llm/starcoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

>>> from pandasai.llm.starcoder import Starcoder
"""

import warnings

from ..helpers import load_dotenv
from .base import HuggingFaceLLM
Expand All @@ -18,16 +18,21 @@

class Starcoder(HuggingFaceLLM):

"""Starcoder LLM API

A base HuggingFaceLLM class is extended to use Starcoder model.

"""
"""Starcoder LLM API (Deprecated: Kept for backwards compatibility)"""

api_token: str
_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"
Comment on lines 18 to 38
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Starcoder class has been updated with a deprecation warning in its __init__ method. This is a good practice when planning to remove or replace a feature in future releases. However, the api_token attribute is still present but according to the PR summary, it should have been removed. Please verify this discrepancy.

-     api_token: str

Also, ensure that all instances where Starcoder is instantiated have been updated to handle the deprecation warning appropriately.