We are currently exploring the role of local knowledge bases (KBs) in RAG (retrieval-augmented generation) AI processing. This post is part of a series documenting our “sandbox” knowledge bases (created over a period of about 20 years) and how we’re using them in various GenAI prototyping projects.
Overview of the RAG processing pipeline
In case you’re new to RAG processing, here is one of our favorite overview diagrams from freeCodeCamp.

Our RAG prototype projects
Our most recent RAG prototype project is part of a series of three Python programs involving a small language model (SLM) and our “grocery shopping” knowledge base, described in detail in other posts, pages, and widgets on this website.
This post is #3 in the set. Here are links to #1 (which had a single supplied query) and #2 (which introduced chat):
RAG processing: Small language model (SLM) with single query
RAG processing: Small language model (SLM) with chat
RAG processing prototype #3: System prompt
Our Python program #3, part of which is shown below, improves the chat’s performance with a system prompt. There is a link to a PDF version of the whole program in the “For more information” section near the bottom of this post.

The system prompt in program #3
Here is the system prompt we added to to program #3.

Our RAG knowledge base: “Shopping for groceries”
Our RAG knowledge base (KB) is “Shopping for groceries”: the smallest and simplest in our DITA/xml KB set. Our sample output has a couple of questions about canned goods, which are discussed in three topics in the knowledge base.

Sample output from program #3
Here is output from one of our test runs of the program.

Tweaking the system prompt in the Python program could undoubtedly improve the bot’s performance.
For more information
Here is a link to a PDF version of our RAG Python program #3.