Marcel Proust is an author I enjoy reading. His In Search of Lost Time is considered to be one of the greatest novels of the 20th century, but many (including myself) also find it long and difficult to understand, so I decided to make a LLM application that might make it easier. It's a very interesting novel that delves into themes like memory and consciousness.
This project is a conversational web app that uses LLaMA (Large Language Model) to interact with users as "ProustGPT," a chatbot inspired by Marcel Proust. It offers three modes: Q&A, Explore In Search of Lost Time, and Refine Prose. The backend is powered by Flask, and the frontend is built using React and Styled Components.
- Q&A: Users can ask questions, and ProustGPT provides responses in a reflective and insightful manner.
- Explore In Search of Lost Time: Users can explore relevant passages from Marcel Proust's In Search of Lost Time. The chatbot retrieves and displays passages related to the user's query.
- Refine Prose: Users can input their own prose, and ProustGPT provides suggestions to refine the writing in the style of Marcel Proust.
- React: For building the user interface.
- Styled Components: For styling the components using CSS-in-JS.
- Flask: For handling API requests and responses.
- llama_cpp: For integrating the LLaMA model for text generation.
- Sentence Transformers: For embedding queries and passages and performing similarity searches using RAG (Retrieval-Augmented Generation).
- Node.js (for running the React frontend)
- Python 3.x (for running the Flask backend)
- A compatible LLaMA model installed locally (e.g.,
Meta-Llama-3-8B-Instruct-Q4_K_M.gguf
) pipenv
orvirtualenv
for Python dependency management
git clone https://github.com/your-username/proustgpt.git
cd proustgpt
cd backend
pipenv install # or use virtualenv + pip install
Ensure you have the required Python libraries, such as Flask, LLaMA, and Sentence Transformers.
cd frontend
npm install
cd backend
pipenv shell # Activate virtual environment (or activate the virtualenv manually)
flask run
The backend should now be running at http://127.0.0.1:5000
.
Open a different terminal, and run the following:
npm start
The frontend should now be running at http://localhost:3000
.
Once the backend and frontend are both running, you can open your browser and navigate to http://localhost:3000
.
You can then choose one of the three modes:
- Q&A: Ask ProustGPT a question about any topic.
- Explore In Search of Lost Time: Enter a query to retrieve relevant passages from In Search of Lost Time.
- Refine Prose: Submit your prose for refinement in the style of Marcel Proust.
- Handles Q&A mode, allowing users to ask questions and get reflective answers.
- For retrieving passages from In Search of Lost Time using RAG based on user queries.
- For refining user-submitted prose in the style of Marcel Proust.
├── backend
│ ├── app.py # Main Flask application
│ ├── parsed.json # Parsed data from In Search of Lost Time
│ └── requirements.txt # Python dependencies
├── public
├── src
├── components
│ └── ChatPage.tsx # Main chat page component
│ └── App.tsx # Main app entry point
│── package.json # Node.js dependencies
└── README.md # Project documentation
- Need to complete the 'Combray' page (gallery)
- Need to add a fine-tuned model for the QA
- Need to add conversation history feature
- Add the French version
- Enhance the Refine Prose mode to provide more intuitive feedback based on the prose context.
- Add more sophisticated RAG methods for the Explore In Search of Lost Time mode.
- Improve LLaMA response quality for longer and more complex queries.
This project is licensed under Apache 2 License.
- LLaMA by Meta for the large language model.
- Sentence Transformers for providing the powerful embedding models.
- The open-source community for all their valuable tools and contributions.