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.67k stars 1.07k forks source link

Return incorrect result for incorrect input #1225

Open ssling0817 opened 2 weeks ago

ssling0817 commented 2 weeks ago

System Info

pandasai version 2.1

🐛 Describe the bug

The table has a column "reporter" which includes a name kevin. I input question which query kevib but it returns kevin's result. The prompt pandasai generated is wrong as it automatically changes my query to the value in the table. How to solve this issue?

dosubot[bot] commented 2 weeks ago

To prevent pandasai from automatically changing your query "kevib" to match the value "kevin" in the table, you can disable the error correction framework. This can be done by setting the use_error_correction_framework property to False.

Here is how you can do it:

# Assuming you have already created a SmartDatalake or SmartDataframe instance named `df`
df.use_error_correction_framework = False

This will prevent the automatic correction of your query terms [1].

To continue talking to Dosu, mention @dosu.

ssling0817 commented 2 weeks ago

I have already set it to false.

agent = Agent(connector, config={"llm": ollama_llm, "enable_cache": False, "custom_whitelisted_dependencies": ["calendar", "dateutil"], "use_error_correction_framework": False})