In this repository, you will find an example code for creating an interactive chat experience that allows you to ask questions about your CSV data. The code uses Pandas Dataframe Agent from LangChain and a GPT model from Azure OpenAI Service to interact with the data. To make the chat more versatile, I incorporated some prompt engineering techniques that instruct the GPT model to use the popular data visualization library, Matplotlib, to create charts based on your queries. The chart is then saved and visualized using the Streamlit frontend interface. This feature can create any type of chart (pie, line, scatter, etc.) as long as you provide clear instructions. Additionally, the code can also return the dataframe as a table or provide a straightforward answer.
The data for analysis is sourced from Kaggle's Telco Customer Churn dataset, providing a comprehensive view of customer information to develop effective retention programs.
To run this Streamlit web app
streamlit run run.py
Sample query to give a straightforward answer.
Sample query to show the result in the table.
Sample query to show the result in a bar chart.
Sample query to show the result in a pie chart.
Enjoy!