-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Default is_chat_model
to True in AzureOpenAI
#563
Conversation
WalkthroughThe changes primarily focus on optimizing the usage of Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files ignored due to filter (1)
- pyproject.toml
Files selected for processing (2)
- pandasai/connectors/yahoo_finance.py (5 hunks)
- pandasai/llm/azure_openai.py (1 hunks)
Additional comments (Suppressed): 6
pandasai/llm/azure_openai.py (1)
- 43-43: The
is_chat_model
parameter in the__init__
method has been changed from an optional boolean with a default value ofFalse
to a required boolean that defaults toTrue
. This change implies that unless explicitly specified, all instances ofAzureOpenAI
will be treated as chat models by default. Ensure that this change is compatible with all existing uses of theAzureOpenAI
class throughout the codebase.pandasai/connectors/yahoo_finance.py (5)
1-4: The import of
yfinance
has been removed from the top of the file and moved to the__init__
method. This change is likely made to handle the ImportError exception in a more controlled manner.16-23: The import of
yfinance
package is now inside a try-except block within the__init__
method. This is a good practice as it allows for handling the ImportError exception if theyfinance
package is not installed, providing a clear error message to the user.36-36: The creation of the
yfinance.Ticker
object has been moved to the__init__
method. This allows theself.ticker
attribute to be reused in both thehead
andexecute
methods, eliminating the need for creating a newyfinance.Ticker
object each time these methods are called. This is a good practice as it improves code efficiency and readability.46-47: The
head
method now uses theself.ticker
attribute to call thehistory
method instead of creating a newyfinance.Ticker
object. This is an improvement as it reuses theself.ticker
attribute created during the initialization of the class, improving code efficiency.114-117: Similar to the
head
method, theexecute
method now uses theself.ticker
attribute to call thehistory
method instead of creating a newyfinance.Ticker
object. This is an improvement as it reuses theself.ticker
attribute created during the initialization of the class, improving code efficiency.
Codecov Report
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. @@ Coverage Diff @@
## main #563 +/- ##
=======================================
Coverage 83.42% 83.42%
=======================================
Files 52 52
Lines 2594 2594
=======================================
Hits 2164 2164
Misses 430 430
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks a lot for the fix @mspronesti, merging! So basically in a few months we'll need to remove the completion function both from OpenAI and from AzureOpenAI, I suppose! |
* fix(connectors): make sqlalchemy non-optional and check yfinance imports * chore(llm): default is_chat_model to True on AzureOpenAI
Hi @gventuri,
as OpenAI has marked the completion API as "legacy" (to be deprecated within 9 months) I have defaulted
is_chat_completion
to True inAzureOpenAI
. Also, please notice that the newest subscription in Azure OpenAI no longer allow to deploy completion-only models (such as davinci) and that the newest versions of turbo and gpt-4 (0613) no longer support the completion API.Summary by CodeRabbit
Refactor:
__init__
method inazure_openai.py
. Theis_chat_model
parameter is now required and defaults toTrue
, enhancing clarity and predictability when creating an instance of the class.