- Description: AI-powered question answering for PDFs with user feedback.
- Tech stack:
- LLM: ChatGPT, LangChain
- Frontend: JavaScript, HTML, CSS
- Backend:
- Language & framework: Python, Flask
- Asynchronous job queue: Celery (Python specific)
- Message broker: Redis
- Vector database: Pinecone
- Tracing & debugging: Langfuse
- Demo:

- (For project isolation) create & activate a virtual environment (dependencies are installed within the virtual environment other than system-wide & all subsequent steps will be performed within the virtual environment):
python -m venv .venv source .venv/bin/activate - Upgrade the pip package manager to the latest version within the current Python environment:
python -m pip install --upgrade pip - Install libraries/packages/dependencies:
pip install -r requirements.txt - Initialize the database (if ever need to clear out all the data from this application, just run this command again):
flask --app app.web init-db
- Install Redis on the macOS system using Homebrew:
brew install redis
There are 3 separate processes that need to be running for the app to work:

-
invoke the Python server (in development mode):
inv dev -
launch the Redis server (the message broker), allowing it to accept connections and handle data storage and retrieval:
# launch the Redis server: redis-server # (only if needed) identify the process using port 6379: lsof -i :6379 # (only if needed) terminate a process: kill <PID> # (only if needed) connect to the Redis instance: redis-cli # (only if needed) retrieve all info from a specific hash using the 'hash get all' command: HGETALL <key> # eg: HGETALL llm_score_counts -
invoke the worker:
inv devworker
If you stop any of these processes, you will need to start them back up!
If you need to stop them, select the terminal window the process is running in and press ctrl+C to quit.
To reset the database: flask --app app.web init-db
Start by creating an account using the following credentials for example: email [email protected], password abc123
- App workflow:

- The Python server:

- Converational QA chain:

- Persistent message storage:

- Conversational retrieval chain:

- Streaming text generation:
streamingcontrols how OpenAI responds to LangChain, and the way to call the model controls how OpenAI resonds to LangChain + how LangChain responds to the user:
- Random component parts in retrieval chain:

- The retrieval chain component maps:

- Self-improving text generation by collecting user feedback:

- Conversation buffer window memory:

- .gitignore File – How to Ignore Files and Folders in Git
- Keyword Argument & Positional Argument in Python
- python-dotenv: Load configuration without altering the environment
- Pinecone Documentation
- Pinecone Examples
- Pinecone AI Support
- Langfuse | Quickstart
- Langfuse | Self-Hosting Guide
- Self-hosted Langfuse