Architecture
How the pieces fit together, what we are building, and what we are adapting to. Below the diagram is our system metaphor.
For a walkthrough of the system, see the project presentation.
What kind of system this is
A client-server web application, which is the ordinary shape for something like this and we are not trying to be clever about it. There is no phone app to install and nothing to download. A patron opens a browser, and a React interface runs there. Everything that matters, the library data and the calls to the language model, happens on a server they never see.
That split is not a style preference. Our model API credentials cannot sit in the browser where anyone can read them, and the check for whether someone is actually a librarian has to happen somewhere a user cannot edit. Both of those force a server.
How a question moves through the system
A patron types a ZIP code and a question. That request crosses the Internet to the Node.js application server, which is the only door into the system.
The server resolves the ZIP code to a county and a library system, then hands the question to the Python AI service. That service searches the dataset in PostgreSQL, narrowed to what that particular library system actually carries, and asks the language model to answer using only what it found. It scores how confident it is. High confidence goes back as a direct answer with its source attached. Low confidence does not get dressed up as an answer; the patron is told plainly and pointed at a librarian, and the question is written to a review queue.
Then the part that usually gets skipped. The answer is a set of steps, and the patron follows them to a site we do not own, NC LIVE or Libby or their county library. We cannot control those pages, so the steps have to be maintained against whatever those sites do next. That is the arrow leaving the bottom left of the diagram.
What we inherit
Three things in this system are not ours, and each one constrains us.
The dataset comes from our client's research team as a spreadsheet on OneDrive. It is still being corrected, so loading it is a job we will run again every time she sends a new version.
The library websites are the actual destination for most answers. Their login flows change without telling us, and a dead link in our dataset turns into a patron stuck at a page that does not work.
The language model is a provider we have not picked yet. Our client has offered us hardware with a local model on it, and cost may decide the question. So the AI service keeps the model behind one interface, and swapping providers should be a day of work rather than a rewrite.
Our XP-style system metaphor, the reference desk, lives on its own page: System Metaphor.