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

model_version="gpt-4" #5

Closed
rajayyala opened this issue Apr 14, 2024 · 6 comments
Closed

model_version="gpt-4" #5

rajayyala opened this issue Apr 14, 2024 · 6 comments

Comments

@rajayyala
Copy link

Hi,

I am trying to set model version to gpt-4 as you suggested in the README file but I am getting the following error:


TypeError Traceback (most recent call last)
Cell In[4], line 6
3 df = pd.DataFrame({"x":[1,2,3], "y": [4,5,6]})
4 ## create a plot
----> 6 plot = PlotAI(df,model_version="gpt-4")
8 plot.make("scatter plot")

TypeError: PlotAI.init() got multiple values for argument 'model_version'

Initially when i tried with the default version , i got the following error:

...
178 """
--> 179 raise TypeError(f'Object of type {o.class.name} '
180 f'is not JSON serializable')

TypeError: Object of type DataFrame is not JSON serializable

Any suggestions how to fix the above errors? Thanks

@pplonski
Copy link
Contributor

Hi @rajayyala,

Are you using version 0.0.3?

@rajayyala
Copy link
Author

rajayyala commented Apr 15, 2024

that is correct...version 0.0.3..but i was able to solve the issue by passing it as keyword parameter..then i got past the error

like so:

plot = PlotAI(df=df,model_version="gpt-4")

that worked...

however i am running into another issue...

frequently the generated python code throws error saying that df is not defined.

this is the code i am trying:

df = pd.DataFrame({"x":[1,2,3], "y": [4,5,6]})
plot = PlotAI(df=df,model_version="gpt-4")
plot.make("scatter plot")

this is the prompt it generated:

**Create a plot in Python with matplotlib package.

Input data:

# pandas DataFrame
'''
   x  y
0  1  4
1  2  5
2  3  6
'''
# DataFrame columns
'''
['x', 'y']
'''

# pandas data frame variable is df

Plot should contain: scatter plot

Initial python code to be updated

# TODO import required dependencies
# TODO Provide the plot

Output only Python code.**

and this is the response:

# import required dependencies
import matplotlib.pyplot as plt

# Provide the plot
plt.scatter(df['x'], df['y'])
plt.xlabel('x')
plt.ylabel('y')
plt.title('Scatter plot of x and y')
plt.show()

as u can see its missing the dataframe variable "df"

Error output:
name 'df' is not defined

attaching some screenshots of the same:

image

image

@rajayyala
Copy link
Author

any suggestions? thanks

@pplonski
Copy link
Contributor

Try to move data frame creation into separate cell.

@rajayyala
Copy link
Author

rajayyala commented Apr 15, 2024

did that...got the same error...

it works some times and doesnt work some times though...so not sure if having it in the same cell is the issue....

also when we do in a python script instead of a notebook then the concept of cell does not arise...right? any thoughts?

@pplonski
Copy link
Contributor

There was bug in the code. I fixed it and released new version 0.0.4, please let me know if it works for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants