This new solution will expose a controlled platform for an end-end LLMs that feed source data with RAG implementation. I'll also use OpenAI python-based SDK and Haystack embeddings in this case. This application developed using Flask, openai & the front-end developed using React. This project is for the advanced Python developer & Data Science Newbi's.
(The following instructions apply to Posix/bash. Windows users should check here.)
First, clone this repository and open a terminal inside the root folder.
Create and activate a new virtual environment (recommended) by running the following:
python3 -m venv venv
source venv/bin/activate
Install the requirements:
pip install -r requirements.txt
To, run the API to create one-time Historical File -
python 1_ReadMuseumJSON.py
To, feed the data into Haystack Framework (Vector DB), one needs to use the following commands -
python 2_feedVectorDB.py
Now, to run the Restricted-API (RAG Solution):
python flaskServer.py
Note down the port number, which will be generated as output.
Run the Proxy:
To run the react app, you need to go to react app and need to fire the following -
```bash
npm start
It will generate the right url, which later can be used inside the react app -
Compiled successfully!
You can now view my-app in the browser.
Local: http://localhost:3001/
On Your Network: http://102.68.1.10:3001/
Note that the development build is not optimized.
To create a production build, use npm run build.
Please find the some of the important dependent package -
pip install farm-haystack==1.19.0
pip install Flask==2.2.5
pip install Flask-Cors==4.0.0
pip install Flask-JWT-Extended==4.5.2
pip install Flask-Session==0.5.0
pip install openai==0.27.8
pip install pandas==2.0.3
pip install tensorflow==2.11.1
Install the above requirements.
Note that the debug indicator is set to "Y". This will generate logs. If you change this to 'N'. No logs will be generated. However, the process will be faster.
- To view the complete demo with sound, check out our YouTube Page.
- To view on Python, check out the Python Page.
- To view more on the OpenAI, check out this OpenAI Official Page.
- To view more on the Haystack, check out this Haystack Official Page.
- To view more on the React, check out this React Official Page.
- For this use case, we've used this open-source brilliant website API, which provides a lot of information free. We've used this as source for education purpose only to demonstrate how one can feed the RAG context to your OpenAI source & get the quick, less-expensive & better response. To view more on the The Metropolitan Museum of Art Collection API, check out this The Metropolitan Museum of Art Collection API Page.