A small RAG demo that chunks a Markdown document, embeds each chunk, stores the vectors in ChromaDB, reranks the best chunks, and can use Gemini 2.5 Pro to generate a final grounded answer.
main.py: runs the full demo pipeline.split_into_chunks.py: loadsdoc.mdand splits it into text chunks.embeddings.py: loads the SentenceTransformer model and creates embeddings.vector_store.py: creates the ChromaDB collection, stores vectors, and queries it.similarity.py: shared vector math helpers, starting with cosine similarity.gemini_llm.py: calls Gemini to turn retrieved chunks into a final answer.
Create a .env file in the project root:
GEMINI_API_KEY=your_api_key_hereIf GEMINI_API_KEY is not set, the app will fall back to the top reranked chunk.
uv run python main.pyuv run uvicorn api:app --reloadThen open http://127.0.0.1:8000/docs to test the API.
uv run streamlit run streamlit_app.pyPowerShell:
.\run_local.ps1Shell:
./run_local.shThis starts FastAPI and Streamlit together and stops both when you exit.
Python:
python run_local.pyIf you are using the virtual environment directly:
.\.venv\Scripts\python.exe run_local.py