The Knowledge Base Assistant App allows users to create knowledge bases by uploading PDF files and querying them using a chatbot interface. Powered by OpenAI, this app enables you to create, manage, and interact with documents using natural language queries.
- OpenAI Integration: Interact with a chatbot using your OpenAI API key.
- Knowledge Base Management: Create new knowledge bases (vector stores) and manage existing ones.
- Document Upload: Upload PDF files to populate the knowledge base.
- Chat Interface: Ask questions based on the content of the uploaded documents.
- Python 3.x
- OpenAI API Key (You can get one here)
-
Install Pipenv by running the following command:
pip install pipenv --user
-
Install project dependencies:
pipenv install
-
Run the chatbot:
pipenv run chatbot
- On the app’s sidebar, paste your OpenAI API key.
- The key allows you to interact with OpenAI's services.
- Create a New Knowledge Base:
- Enter a name for your knowledge base in the "Create a New Vector Store" section and click the Create Vector Store button.
- Select an Existing Knowledge Base:
- If you have previously created knowledge bases, you can select one from the dropdown list.
- After creating or selecting a knowledge base, upload a PDF document by clicking the Choose a file button.
- The file will be indexed and added to the selected knowledge base.
- Once a knowledge base is selected, you can interact with the assistant by typing your queries in the chat input.
- The assistant will respond based on the uploaded documents.
Chatbot.py
: Main entry point for the Streamlit app.loaders/indexer.py
: Handles indexing of uploaded documents into the knowledge base.main.py
: Contains core functions such as handling prompts and getting responses from the OpenAI API.
list_folders(directory)
: Lists all folders in the knowledge base directory.create_new_folder(directory, folder_name)
: Creates a new folder to store uploaded files.save_uploaded_file(uploaded_file, save_dir)
: Saves an uploaded file to the specified directory and indexes it for later use.
- Fork the project.
- Create your feature branch:
git checkout -b feature/AmazingFeature
- Commit your changes:
git commit -m 'Add some AmazingFeature'
- Push to the branch:
git push origin feature/AmazingFeature
- Open a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.
For any issues or questions, feel free to contact @hnaseem1.
Enjoy using the Knowledge Base Assistant App!