Skip to content
sadat.
Academic project

EWU RAGBot

A document-grounded assistant exploring semantic search and generated answers.

Knowledge, connectedAsk. Retrieve.
Understand.
DocumentsRetrievalAnswers
The shape of the work

How EWU RAGBot finds an answer

The pipeline runs in two halves: documents are prepared once and stored, then a question retrieves context and an answer is produced from it.

Preparing documentsRaw files become text the pipeline can work withLoadUniversity source materialStructureCleaned into textPassagesOne document becomes manyOne documentA whole documentMany passagesPassage 1Passage 2Passage 3Retrieval works on passages, not on whole documents.Schematic of the retrieval pipeline

A whole document is loaded and cleaned, then divided into many passages. Each passage becomes one retrievable unit rather than the document being searched as a whole.

Generating embeddingsEach passage becomes a vectorPassageA slice of textEmbedderSentence transformerVectorFixed-length numbersA vector is a list of numbers0.120.480.83and so onComparable meaningSimilar passages sitclose in this spaceMeaning becomes distance, so search can be by similarity.Schematic of the retrieval pipeline

Each passage is converted into a fixed-length vector. Passages that mean similar things sit close together in that space, even when their wording differs.

Storing and retrievingThe question is embedded the same wayVector storeOne embedded passage per rowpassage 1nearest matchpassage 3passage 4QuestionEmbedded tooQuerySimilarity searchContextTop passagesA weak match is still a matchSimilarity alone does not guarantee the passage answers the question.Retrieval returns the closest passages, not a verified answer.Schematic of the retrieval pipeline

Passage vectors are stored one per row. The question is embedded the same way and matched against them, and the nearest passages come back as the context.

Building the promptContext and question travel togetherContextRetrieved passagesas the evidenceQuestionWhat the user askedPromptcontext and questionin one messageModelGenerates from itThe model answers from the assembled prompt, so the context decides what it can say.Everything the model knows about the question arrives in the prompt.Schematic of the retrieval pipeline

The retrieved passages and the user’s question are placed into one message. The model then answers from that message, so the context bounds what it can say.

Producing an answerGenerated text, then a check against the sourceGenerateThe model writesCompareAnswer against contextInspectA human judges itWhat is not claimedNo accuracy score is published for the pipeline.No guarantee that every answer is correct.No citation is attached to a generated answer.No production deployment is described.The notebook is an experiment, and it is presented as one.Schematic of the retrieval pipeline

The model writes the answer, the answer is compared against the retrieved passages, and a person judges the result. No accuracy figure, citation, or production claim is made.

Preparing documents

The challenge

University material arrives as documents, but retrieval works on smaller pieces of text that can be compared with one another.

RAGBot’s approach

Documents are loaded and structured, then split into passages. Each passage becomes the unit that is embedded and stored.

Why it matters

The quality of every later answer is decided here, because a passage that was split badly cannot be retrieved well.

Under the hoodThe two paths, kept apart
  1. 01
    Load the documents
    Python

    University source material is loaded into the notebook and turned into plain text that can be split.

  2. 02
    Split into passages
    Text splitting

    The documents are divided into passages, because a passage is small enough to embed and specific enough to retrieve on its own.

  3. 03
    Embed each passage
    Hugging Face

    A sentence-transformer model converts every passage into a vector, which is the form the store can compare.

  4. 04
    Store the vectors
    ChromaDB

    The embedded passages are written to a ChromaDB vector store, which is the offline half of the pipeline.

  5. 05
    Embed the question and retrieve
    ChromaDB

    At question time the question is embedded with the same model and matched against the stored vectors to pull back the nearest passages.

  6. 06
    Assemble the prompt and answer
    LangChain and Gemini

    LangChain places the retrieved passages and the question into one prompt, and Gemini generates the answer from it.

Documents are chunked and embedded into a ChromaDB vector store, then retrieved passages feed a LangChain chain and Gemini. Ingestion and question answering are separate steps: the store is built once from the documents, and each question is answered against it.

Inside the project

What it actually does

01

Document preparation

Turns university material into retrievable passages.

02

Semantic search

Hugging Face embeddings and ChromaDB find relevant context.

03

Context-based answers

LangChain connects retrieved passages with language models.

04

Evaluation experiments

Examines retrieval quality and generated-answer behavior.

The workflow

How it moves forward

  1. 01

    Prepare

    Structure documents and generate embeddings.

  2. 02

    Retrieve

    Find passages related to a question.

  3. 03

    Respond

    Generate an answer using the retrieved context.

Technology

The tools behind it

Which component runs on which technology

Notebook pipeline

  • Python
  • LangChain

Vector store

  • ChromaDB

Embeddings and generation

  • Hugging Face
  • Gemini

Interface

  • Gradio
System architecture

How the pieces connect

  • Ingestion: Documents. University source material. Chunking. Source material split into passages.
  • Index: Hugging Face embeddings. Sentence-transformer vectors for each passage. ChromaDB. Vector store queried at request time.
  • Response: LangChain chain. Assembles the question and retrieved context. Gemini. Generates the answer from that context.
Derived from project structure: Documents are chunked and embedded into a ChromaDB vector store, then retrieved passages feed a LangChain chain and Gemini.
Under the hood

Engineering decisions

What was decided, and why
Once, offlineDocumentsEmbeddingsStorePer questionQuestionRetrieveAnswer

Ingestion kept separate from questions

Building the store is an offline step over the documents, while each question runs only against the passages that were already embedded.

NotebookObservedbehaviour comparedNot claimedaccuracy or deployment

Experimental by design

The notebook compares model and retrieval behavior. It is an academic experiment rather than a deployed support service.

The hard parts

Challenges

The parts that did not come for free

Retrieval is simple to describe and awkward to build. These were the parts where the honest answer was a trade-off rather than a technique.

Documentone blockEach passage is embedded on its own

Splitting documents well

A passage that is too long dilutes its meaning and a passage that is too short loses the context needed to answer from it.

Vector storeQuestion embeddedThe nearest passages become the context

Retrieving something relevant

Similarity alone can return a passage that is on the topic but does not carry the answer the question needs.

ContextAnswercompared against it

Answering from the context

The generated answer has to stay grounded in the retrieved passages, and the notebook treats that as something to check rather than assume.

NotebookObservedbehaviour comparedNot claimedaccuracy or deployment

Measuring without overclaiming

The pipeline is an experiment, so the project compares behaviour rather than publishing an accuracy score it has not established.

Afterwards

What stayed with me

Lessons from building it

What stayed with me from building the retrieval pipeline was mostly about how much of the work happens before the model is ever called.

Documentone blockEach passage is embedded on its own

Preparation decides the ceiling

Document preparation shapes the quality of retrieval. A weak store cannot be rescued later by a stronger model.

Vector storeQuestion embeddedThe nearest passages become the context

Relevant is not the same as sufficient

A retrieved passage can be on topic and still not contain the answer, which is why the context has to be inspected.

ContextQuestionPromptorder mattersAnswerAssembly is part of the design

Context assembly is a design decision

What goes into the prompt and in what order changes the answer, so the assembly step deserves the same attention as the model.

NotebookObservedbehaviour comparedNot claimedaccuracy or deployment

An experiment should say so

The project states what it tried and what it observed instead of implying a deployed system it has not built.