Sinaptik-AI / pandas-ai

Chat with your database (SQL, CSV, pandas, polars, mongodb, noSQL, etc). PandasAI makes data analysis conversational using LLMs (GPT 3.5 / 4, Anthropic, VertexAI) and RAG.
https://pandas-ai.com
Other
11.7k stars 1.08k forks source link

LLM not following description in config #1123

Open credelosa2022 opened 2 months ago

credelosa2022 commented 2 months ago

System Info

Os version: Google Colab Python version: Google Colab Pandasai version: 2.0.34

🐛 Describe the bug


from pandasai.llm import GooglePalm

llm = GooglePalm(api_key="xxxx")

data_df = pd.read_csv("Loan payments data.csv") #This is from your example in github

sdf = SmartDataframe(data_df, config={"llm": llm,
                                      "description":"You are a data analysis agent. Your main goal is to help non-technical users to analyze data. When you provide visualizations, make sure you include the axis labels.",
                                      "seed": 2024})

sdf.chat("In the same graph, show the age distribution where each histogram corresponds to a gender category. ")

image

Is there a better way to do this?

seanshanker commented 2 months ago

i'm a newbie in this area myself...so take what i say with a pinch of salt..i didnt realize you could tell it to plot with axes labels in the description. i've usually done it in the sdf.chat with decent success.

ArslanSaleem commented 2 months ago

credelosa2022 instead of config pass description to Agent class like:

agent = Agent([data_df], config=config, description="You are a data analysis agent. Your main goal is to help non-technical users to analyze data. When you provide visualizations, make sure you include the axis labels.")

agent.chat...

Let me know if it helps

Thanks

adri0 commented 2 months ago

I noticed that since the version 2.0.34 my tests using the and Agent with FakeLLM started breaking.