RAG with pgvector: how the UAF Smart E-Library answers questions
My final-year project needed answers grounded in the library’s own documents, not a chatbot’s guesses. Here is the plain, working recipe: chunk, embed, store in pgvector, retrieve, answer.

The UAF Smart E-Library had a simple brief with a hard edge: students should be able to ask a question and get an answer drawn from the library’s material — not a fluent paragraph the model invented. That constraint is the whole architecture.
The pipeline is plain on purpose. Documents are split into chunks small enough to be specific, each chunk is embedded into a vector, and the vectors live in PostgreSQL through the pgvector extension — the same database as everything else, because a final-year project does not need a second datastore to babysit. A question is embedded the same way, and similarity search returns the handful of chunks that genuinely bear on it.
Those chunks become the context for generation. The model’s job shrinks from "know everything" to "answer from this evidence", which is a job it can actually be trusted with. When retrieval finds nothing relevant, the honest answer is that the material does not cover it.
If I rebuilt it today I would add evaluation — a fixed set of questions with known answers, scored on every change — but the shape would stay the same: retrieval first, generation second, grounding always.