/chatpdf

chat with pdf with mistral.ai + streamlit

Primary LanguageJupyter Notebook

Chat with PDF using Mistral + Streamlit

Setup

Get an API key from mistral.ai

Create a file .streamlit/secrets.toml with a

MISTRAL_API_KEY="<YOUR_MISTRAL_KEY>"

Install uv (what is uv?)

pip install uv

Create virtual environment

uv venv # Create a virtual environment at .venv.

Activate virtual environment

# On macOS and Linux.
source .venv/bin/activate

install requirements

uv pip install -r requirements.txt

Run the app

streamlit run app.py

improvements

  • only the last message is sent to LLM, pass the last few messages to client.chat_stream(...)
  • cache queries
  • improve chunk retrieval for longer context questions
  • sanitize inputs and outputs