Skip to content

Python Streamlit web app allowing users to interact with their data from a CSV or XLSX file, utilizing OpenAI API and LangChain. It imports necessary libraries, handles API key loading, displays a user-friendly interface for file upload and data preview, creates a Pandas DF agent with OpenAI, and executes user queries.

Notifications You must be signed in to change notification settings

petermartens98/OpenAI-LangChain-Pandas-DF-Agent-Query-Streamlit-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI LangChain Pandas DF Agent Query Streamlit App

Description

Python Streamlit web application designed to provide a user-friendly interface for querying and communicated with data from a CSV file using the OpenAI language model.

The script begins by importing the necessary libraries, including os for operating system interactions, streamlit for building web applications, pandas for data manipulation, dotenv for loading environment variables, and langchain to for interacting with the openAI API and creating a Pandas DF agent.

The main functionality of the script is contained within the main() function. It starts by loading the OpenAI API key from the environment variable and checking its existence. Then, it sets up the Streamlit application by displaying a title and description. The user is prompted to upload a CSV file, which is read using pandas and displayed as a preview.

A pandas dataframe agent is created using the OpenAI language model, and the user is prompted to enter a query. Upon clicking the "Execute" button, the query is sent to the agent, and the answer as well as conversation is displayed on the application interface. Overall, this script provides a convenient way for users to interact with their CSV data and obtain answers based on their queries using the OpenAI language model.

App V3 Improvements

  1. Implemented .env variable for OpenAI API key.
  2. Improved prompt for pandas df agent, taking into account prvious chats.
  3. Improved CSS
  4. .XLSX File Support
  5. LLM Temperature Slider

App V3 Screenshot

image

App V2 Improvemnts

Added conversational memory and the abiliy for a continuous chat istead of a single Q&A

Example Screenshots App V2

image

Example Screenshots App V1

image

About

Python Streamlit web app allowing users to interact with their data from a CSV or XLSX file, utilizing OpenAI API and LangChain. It imports necessary libraries, handles API key loading, displays a user-friendly interface for file upload and data preview, creates a Pandas DF agent with OpenAI, and executes user queries.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages