P17 - Digital Textbook Implementation
The first Chapterof the Digital Textbook on Machine Element Design is complete. It is running on Google Cloud.
For teaching with LLMs, I have been experimenting with a framework I call Digital Textbook Programs (DTPs). The core proposition is to use the LLM strictly as an interface or translator, rather than a primary source of facts. In this model, knowledge is partitioned into two distinct parts:
The Textbook: The structured pedagogical narrative.
The Knowledge Base: A set of verified computational functions.
The sketch below summarises the concept.
The Project: Machine Element Design
I am currently developing a DTP for Machine Element Design, a second-year mechanical engineering subject. Having taught this course for several years, it felt like the perfect candidate for a proof-of-concept.
The implementation has been surprisingly smooth. While the narrative text is still a work in progress, the "software" side—which I call the Curator—is fully operational on Google Cloud.
At present, the access is restricted to approved email addresses. If you would like to experiment with it, please let me know and I can add you to the list.
The textbook
I authored the textbook using Quarto, an open-source scientific publishing system. It’s essentially a more stable, professional evolution of Jupyter Notebooks. Quarto allows me to write once and render the content as a polished website or a PDF book.
In a university setting, the introductory chapter would typically cover course assessment, allowing the Curator to handle student queries about grading or deadlines. However, for this pilot, I’ve jumped straight into Chapter 2: Materials in Mechanical Design.
I began with carbon steels, as they are foundational. Once the structure is finalized, adding stainless steels, aluminum, and polymers will be a simple matter of expansion. Whether the student reads this as a PDF or a web page, the experience is the same: static, high-quality text paired with a link to the Curator.
Of course, there can be many links in the textbook that connects to the different corpus sections in the Curator.
The Curator: Precision via Function Calling
The Curator is a Flask application hosted on Google Cloud. At its heart, it is a suite of Python functions designed to answer specific engineering questions.
For example, I wrote a function called steel4YS. It takes a required yield strength as an argument and returns the specific steel designation that meets that threshold. To bridge the gap between the student and the code, I provide the LLM with a JSON definition of the function:
{
"type": "function",
"name": "steel4YS",
"description": "Returns the steel grade that just exceeds a target yield strength (MPa).",
"parameters": {
"type": "object",
"properties": {
"yieldstrength": {
"type": "number",
"description": "Minimum target yield strength in MPa."
}
},
"required": ["yieldstrength"]
}
}
How the Loop Works
When a student submits a query, the Curator forwards the request to the LLM together with the available function definitions. Crucially, the LLM is instructed not to answer the question directly. Instead, its role is to interpret the student’s natural-language query and determine which function should be executed and with what arguments.
For example, if the student asks:
“Get me a steel with a minimum yield strength of 280 MPa.”
the LLM interprets the request, matches it semantically to the steel4YS function, and returns a structured instruction equivalent to:
Run steel4YS(280).
The Curator then executes the function locally and returns the computed result to the student.
Why This Matters
By keeping the LLM in the loop, students can interact using natural language—no rigid syntax required. By keeping the LLM out of the actual calculation, we eliminate the risk of hallucination.
Unless there is a bug in my Python code, the result is 100% accurate, every single time. This turns the LLM into a brilliant librarian who finds the right book and opens to the right page, rather than an unreliable narrator trying to recite the data from memory.
Note: Access to the Curator currently requires being on an approved email list. If you would like to test the system, please reach out.
.



