This is a simple web application that allows you to interact with an OpenAI Assistant that has access to your uploaded documents through a vector store.

- Python 3.8 or higher
- OpenAI API key
- Documents already uploaded and processed into a vector store
- Clone this repository
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the root directory with your OpenAI API key:OPENAI_API_KEY=your_api_key_here
- Run the file upload script to upload your documents and create a vector store:
This will create a
python scripts/file-upload.py
vector_store_info.json
file with your vector store ID.
- Start the Flask application:
python app.py
- Open your browser and navigate to
http://localhost:5000
- Start chatting with the assistant about your documents!
You can list all available vector stores using the provided script:
python scripts/list-vector-stores.py
This will display all vector stores in your account, including their IDs, names, descriptions, creation dates, and associated files.
The web application includes a dropdown menu in the header that allows you to:
- View all available vector stores
- Select a different vector store to use with the assistant
- Refresh the list of vector stores
When you switch to a different vector store, the application will:
- Update the vector store ID in
vector_store_info.json
- Create a new assistant with access to the selected vector store
- Start a new conversation thread
- The application creates an OpenAI Assistant with access to your vector store
- When you send a message, it's added to a thread
- The assistant processes your message and searches through your documents to provide relevant answers
- The response is displayed in the chat interface
app.py
: The Flask applicationtemplates/index.html
: The HTML template for the chat interfacestatic/css/style.css
: CSS styles for the chat interfacestatic/js/script.js
: JavaScript for handling the chat functionalityscripts/file-upload.py
: Script for uploading files and creating a vector storescripts/list-vector-stores.py
: Script for listing all vector stores
- The assistant and thread IDs are stored in
assistant_info.json
for reuse - The vector store ID is stored in
vector_store_info.json
- The application uses the OpenAI Assistants API v2 with the file_search tool