Ryan Singh

RAG Omeka

Code · 2025 · Solo

#python#llm#rag#langgraph#museums

The app's Interactive Graph Vector Database page: a 3D UMAP plot of the FAISS vector store, with the 2,333 artworks as coloured points that form distinct clusters.

I love art, and this project started from a small idea: making art accessible.

The problem

The Richard and Carole Cocks Art Museum (RCCAM) at Miami University publishes its collection on Omeka, but finding a piece meant searching an outdated, SQL-style system. A curator had to know exactly what to type, and even then, objects might not be tagged properly or might be missing information. A question like “prints of rural landscapes from the 1800s” had no good way in.

What it does

RAG Omeka lets anyone ask the collection a question in plain English. ART CHAT answers using only what’s in the museum’s records, and shows the artworks it drew on, each with its image and a link back to the museum’s own page. If the answer isn’t in the collection, it says “I don’t know” instead of making something up.

How it works

  1. Collect. A scraper walks the museum’s Omeka site and saves every item’s record (title, creator, date, medium, subject, description, tags and donor) for 2,333 artworks.
  2. Embed. Each record becomes a short text summary, embedded with OpenAI’s text-embedding-3-small (or Nomic, to run fully locally), and stored in a FAISS vector index.
  3. Answer. A small LangGraph pipeline runs three steps:
    • Extract keywords. The model plays an art-museum curator and pulls the searchable terms (artists, styles, periods, materials) out of the question.
    • Retrieve. It searches the index with both the original question and the keywords, then removes duplicates. Asking twice catches artworks one phrasing alone would miss.
    • Generate. It writes an answer grounded only in the retrieved records.
  4. Show. A Streamlit app puts it together: the chat, and an interactive 3D map of the vector space showing how the collection clusters.

It runs on GPT-4 in the cloud, or on Llama 3 locally through Ollama, with one switch. And it isn’t tied to this museum: point the scraper at any collection published on Omeka and it works the same way.

What I learned

The repository also holds the notebooks I learned with, from a first LangChain RAG tutorial to the LangGraph version and the vector-space visualisation. Building this led straight into my later research on retrieval-augmented generation (see Papers), and I now teach the same ideas in a workshop on LLMs and RAG.

Stack: Python, LangChain, LangGraph, FAISS, OpenAI and Ollama models, Streamlit, Beautiful Soup.