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.69k stars 1.08k forks source link

Custom head not working #1147

Open Hrishikesh-Dutta0078 opened 1 month ago

Hrishikesh-Dutta0078 commented 1 month ago

System Info

Python version : 3.11.9 OS version : 64-bit operating system, x64-based processor Pandsai version : 2.0.28 (enforce privacy not working on above versions)

🐛 Describe the bug

I am using Azure OpenAI and Custom head is not working in my case. Here is are my code snippets : llm = create_llm()

        head_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]
        })
        df = Agent(data_frames, config={
            "llm": llm,
            "enable_cache": True,
            "open_charts": False,
            "response_parser": PandasDataFrame,
            "custom_head" : head_df
        })

def create_llm(): """Create and return an instance of the Language Learning Model.""" return AzureOpenAI( api_token=API_TOKEN, azure_endpoint=AZURE_ENDPOINT, api_version="2023-05-15", deployment_name="pandasai-gpt-4" )

fab2112 commented 1 month ago

I understand that the framework is evolving, but I have noticed that "enforce_privacy" and "custom_head" have no effect on the final output of the prompt, I have even observed the final output of the prompt via langchain (langchain.debug=True) and sensitive data appears.

PandasAI version: 2.0.37 Python version: 3.11.2 OS: Linux