You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Gabriele,
Thank you so much for incorporating gpt-4o so quickly and for making the amazing Pandas-AI! I've just updated to version 2.0.40, and am getting an error from running get_openai_callback.
Consider the following example:
import pandas as pd
from pandasai import Agent
from pandasai.llm.openai import OpenAI
from pandasai.helpers.openai_info import get_openai_callback
df = pd.DataFrame({
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
"gdp": [19294482071552, 2891615567872, 2411255037952, 3435817336832, 1745433788416, 1181205135360, 1607402389504, 1490967855104, 4380756541440, 14631844184064],
"happiness_index": [6.94, 7.16, 6.66, 7.07, 6.38, 6.4, 7.23, 7.22, 5.87, 5.12]
})
llm = OpenAI(api_token=some_token, model = "gpt-4o")
df = Agent(df, config={"llm": llm, },)
with get_openai_callback() as cb:
response = df.chat('Which are the 5 happiest countries?')
print(response)
print(cb)
This example yields the following error:
Unfortunately, I was not able to answer your question, because of the following error:
System Info
macOS m3 14.4.1
Python 3.11.7
pandasai 2.0.40
馃悰 Describe the bug
Hi Gabriele,
Thank you so much for incorporating gpt-4o so quickly and for making the amazing Pandas-AI! I've just updated to version 2.0.40, and am getting an error from running get_openai_callback.
Consider the following example:
This example yields the following error:
I wonder if this error is caused by the v2.0.38 amendments to openai_info.py? This error disappears if I remove
with get_openai_callback() as cb:
Perhaps adding 'gpt-4o-2024-05-13-completion' under the list commencing # GPT-4 output will resolve the error.
Kind regards,
Ben
The text was updated successfully, but these errors were encountered: