TetraMesa

  • About Us
  • Services
  • Clients
  • Contact
  • Blog

Adding a GPT with RAG to a WordPress Site

June 19, 2025 By Scott

A couple of weeks ago I deployed a small WordPress website in support of a particular medical community. My goal was to test using WordPress vs. A Gen AI website builder and see how well a moderately technical product manager type, (but not a developer), could use some tools to make digital things. I kind of joked at the end that “I’ll probably toss in a GPT Chat feature because, well, I mean… it’s 2025.” I wasn’t actually going to bother, but, really now… it is 2025 after all. The site should have a GPT. So let’s have at it! (Here’s the end result by the way: ACL-GPT.)

We Can Do This The Easy Way Or…

The easy way is to grab one of the many options to slap in a plug-in. Probably the smart way. And yet, besides being slightly unsatisfying, would lock into someone else’s cost structure and features. Maybe with slightly more effort, I can create my own little GPT and have it work any way I’d like. The cost is the difference between maybe 30 minutes to install a plugin versus a day or so to roll my own. (But it will also be more fun to do it myself.)

Let’s Have at It

Alright, I’m not entirely starting from scratch as I’ve already got some tools…

  • A WordPress powered site up and running, ACL Support, a site to help others – like myself – who have suffered an ACL injury and likely surgery. It has information that answers what are typically recurring questions in various forums on the topic. I’ve been hurt before, but this was bad. I’m not sure which was worse, the initial injury, (while playing ice hockey), or the first week post-op. This site is my thank you to the many who helped me with info before and through the rehab process.
  • An n8n account, which is a no-code/low-code workflow automation platform that can easily connect generative AI models (like ChatGPT) to other systems.
  • A Pinecone account for a vector database, (which works great), but we’re going to switch over to Supabase just to try out a different tool and this is a low volume site so the free version should take it pretty far. (And Pinecone may be great for vector data, but some simple relational tables will be needed here as well, and Supabase can handle both needs.)

So What Needs to Be Added to the Cauldron?

To brew up the full deal here, we’ll need more pieces.

  • We’ll need a chatbot UI/UX. Should it be a plug-in? A patch of HTML/JavaScript? Hmmm… we have a product decision issue. Should it replace the already existing blog search? Or is it its own thing? OK, we actually have to think this through.

Strengths and Weaknesses of Each Approach

Feature TypeStrengthsWeaknesses
Traditional simple blog searchFast, direct access to site content; supports filters and categories.Limited to keyword matching; less effective or maybe even useless for complex queries.
GPT/AI SearchContextual, conversational, can summarize content and answer complex queries, drawing from multiple data sources.May “hallucinate” or provide answers not directly linked to site content; slower for simple lookups.

Hybrid? Maybe. A hybrid option may be best, but more complex to implement and may not be easy to use yet. Though that will change as Users get used to hybrid results. Look at what all the major search engines are doing with their summaries. For now, Users know what to expect from each feature; search for finding content, GPT/AI for conversational help, summaries, or complex questions.

Okay, that settles it… We’ll keep them as separate features for now, with search available within the blog content, and the chatbot clearly it’s own feature. We can extend it later if desired.

We’ll need an n8n Workflow. This will tie everything together. It will do the heavy lifting and we’ll go through the steps in a moment. I’ll try having ChatGPT or Claude just generate the JSON for the first cut at an n8n Workflow scaffold, and tweak it as necessary. (They rarely get these right from the start.)

First, we’ll need a Vector Database to Store Things

We’ll use Supabase. My goal is a useful site, but it’s still a hobby effort so I’m using the least expensive option for my intended use case. We need something that’s good for vector storage and is reasonably sophisticated for updates/upserts, etc. (Using GPT-3.5 Turbo also helps. The CPM math works such that if I bust the free limits, I’d have to put up some PPC ads. The CPM for the category would slightly exceed costs based on anticipated token usage. We’ll see.)

I can create the fields I need by hand. Or dust off some rusty SQL skills. Mostly I’ve used SQL to retrieve data for reports, not to build. So this may be challenging… oh… waitaminute… I’ll just ask a GPT to generate the SQL I need for the fields. Which it did. Then just Cut/Paste into the Supabase SQL editor, and hit run. Done. Seriously. Some things here are hard. Others, not even a little.


Next, a Workflow to Load Initial Documents

Here, we GET the docs, map fields to our database, make sure we’re not loading unpublished documents, transform HTML to simpler markdown, and finally, load them into Supabase after passing through an embeddings process. Remember, we’re not doing regular ole’ search; we’re using vectors. And embeddings have to be consistent. In this case, using ChatGPT. (Mostly because I already have a paid account and I’ve worked out what my token costs will be for this effort to keep it really small.) You can’t just swap out engines without making sure the embedding model is compatible. The model doesn’t necessarily have to be the same, but the query embeddings must match any stored document embeddings. (For details, see LLM / Text Vectors for Product Managers.)

Now Let’s Handle New Documents

This gets more involved. We’re going to an Upsert function to Update documents that have changed, and Insert new documents. Again, we’re not simply loading documents. These are converted to vectors so documents are broken apart, (chunked), and turned into vectors. You can’t just easily see the documents in the database tables. Another thing here is to keep track of timestamps so as to only load updated or new documents. Otherwise, we’re wasting cycles checking for dupes on the database side and just wasting bandwidth / CPU in general.

Finally, The GPT Itself!

Now we have to set up a webhook so the UX on the WordPress site can call it, get a response and display it. We also want to maintain memory of the ongoing chat to keep the context alive with additional user prompts. So there’s some back and forth here with another database table for the chat history.

Next, it’s time to generate HTML/JavaScript for the WordPress site and embed it in a page as code. This isn’t too hard. But it took a lot of back and forth to get formatting somewhat human readable. What should have taken 20 minutes took a couple of seriously annoying hours. (And it’s still not great.)

So. How’d We Do?

Pretty Good! It was just more painful than I’d anticipated. It could use some more work to hone the outputs, but it’s generally functional and useful.

It works! You can try it here: ACL-GPT

I’d anticipated this would take a few hours in the morning and maybe some evening touch-ups. Which maybe it should have. I kind of knew there might be some blockers. And there were. A lot. (Some are at an addendum at the end of this write-up.)

Total task time was more like 20 hours over a couple of weeks. It probably would have been shorter if I could have focused in fewer sessions. n8n made a lot of it easy. However, these things are still a bit clunky; nodes don’t always work cleanly, etc. For code within nodes, I mostly used GPTs. While all of them are sickly sweet and annoyingly cheery along the way, they also, (all of them), led down incorrect time wasting paths.

I’m in a GPT State of Mind

I was also trying to be observant of my own state of mind while interacting with the GPTs, especially my emotional state. Sometimes I was grateful for a working node! Success! Satisfaction! Even childlike joy. (It’s fun to make things work.) And frustration, annoyance when things didn’t work. But is that fair? How is it at all sensible to be frustrated with such enabling tools that weren’t even available until just a few years ago? Here I am, alone, getting a custom AI GPT with RAG to work all by myself. So it maybe takes a few hours longer than expected. (How quickly we up our expectations.)

Even if there were frustrating moments, for a solo person to just build this inside of a week or two or three, just part time while watching TV or something, that’s still kind of a “Wow” factor to me.

My takeaways: Skilled coders and architects are still necessary. It’s going to be some time before these things do a reliable job even with their fast improvements. What I did here was got production code out, even if just a small hobbyist site. But is the backend good? This is the sticky part. I’m not really sure. After I got it working, I mostly stopped. I did check some things for security, but not much. Partly because I don’t know how. To do this, it is hugely helpful if you had done at least some code at some point and know something about database structures and so on. I have some small amount of that talent and skill. But not terribly much. I like my little hobby product. But is it really stable? Or brittle? If something breaks, how quickly will I be able to diagnose and fix it? Likely not very well or at least, somewhat painfully. At least for anything safety or mission critical, I sincerely hope we keep humans well into the loop.

But… But… Where’s the Strategery?

Where’s the Product Management Strategy in all this? Is there any?

Not much really. The strategy was, “I think this might be useful. And I can slap together a kind of sort of mostly working for real version in a couple of days without bothering anyone at all.” For something more complicated, of course a team approach is better. However, in a constraint driven situation, you can maybe just do things.

Workflow automation tools with AIs provide scaffolding for logical application architecture. As a product manager, I typically like to be and need to be ‘outward facing’ towards markets and customers. But as a digital product manager who’s also done a lot of startups, I’ve often found I’ve needed to be a “utility player” and just pick up whatever role was necessary to get stuff done.

There’s a lot of talk about whom AI is likely to replace. I think the answer is not many really, though there will be a period where people think so and run off and fire a bunch of folks. OK, there may be less need for some aspects of junior coders, and other easy to automate roles. But we’ll still need good people; we’ll all just have more capabilities. The funny thing about some of the conversations I see is when people think they’ll need less product managers or marketers and such. It’s admittedly self-serving for me to say, “no, I don’t think so,” but there’s some historical precedent. There are technical fields the “non-tech” person is not going to just step into. No one wants the marketing person to be building brand new algorithms for the new aircraft’s avionics system. But I’ve seen plenty of tech implementations where the concern was “the business people won’t be able to handle some of this tech,” when the reality turned out to be they integrated just fine. Ironically, it was some of the technologists that struggled with the business aspects. This is its own giant separate conversation. The bottom line is that when those closest to customers can get products or experiments to market with the least amount of friction, I think that’s more likely to get to success faster. I’m not talking about the wanton mad scrambles to get the often misnamed Minimum Viable Products or tests to market. I’m just talking about faster. There’s a difference between “faster” and “reckless.” If these tools are used properly, we should be able to speed up significantly, and yet avoid giant wrecks.

Conclusion / Wrap Up Thoughts

Some of this functionality is quickly becoming table stakes items. There’s varying degrees of complexity of course, depending on what you’re doing, but the base level integration into a simple content site is reasonably accessible even with minimal skill and even less so at relatively low costs to bolt on. There is some minimal coding required. Yes, the GPTs can help. But it is hugely helpful if you’ve at least had some history with code enough to understand it, maybe be able to manually modify a thing or two that’s wrong, or minimally, be able to understand enough to ask a code assist GPT the right questions to fix things. And yet still I repeat again, I’m not personally a developer. Not by a long shot. But I can personally get this all wired up in a couple of days. Years ago I worked on an ML oriented project that took a whole team months just to do some of this sort of thing. Now? Now I got it done alone, in some spare time, while spending maybe $15 on a credit card. Crazy.


Addendum

Tips / Traps for Builders

STOP reading now if you were just casually curious about this. But if you want to do this yourself, here’s some tips / traps.

  • n8n is great: Like any workflow tool, it helps to just go step by step and see things executing, troubleshooting as you go. However, (probably like most such tools), it’s not perfect and some nodes are problematic. You may need to go to somewhat more manual Code nodes in some places. And sometimes, if something’s not working, just refreshing the screen on the workflow clears things up.
  • Wiring things up can take an inordinate amount of time: As you get used to a product, of course it gets easier. But just sorting out API access points, creating permissions and so on, can take a lot of time. And this is even more so when you’re not just writing a monolithic application, but integrating multiple pieces from various sources. Those sources won’t always play nice together. A parser on n8n might handle things differently than a database. You may need to transform some items like JSON objects before they can be consumed by other processes.
  • Use actual APIs or Dedicated Nodes if you can: For example, there are WordPress nodes for WordPress APIs in n8n. But the place where you’re hosting WordPress may have firewall level security on some API functions. So when you set up an API user in WordPress, it won’t work, even if it looks ok. You may have to struggle with a provider’s customer service to get access or get your instance permissioned for such things. So you might be forced to use generic HTTP calls or Code blocks. But part of the whole point here is to click and connect. So if possible, stick with dedicated nodes. Note also to take care with GPT instructions. At least for now, they get a whole lot wrong with their configuration instructions.
  • Supabase: All database services may vary. But in Supabase, there is a row level security policy that had to be set. Simple databases shouldn’t be that challenging. They’re kind of just rows and columns like a spreadsheet. But there’s a little more to it. Getting the field data types right also shouldn’t be that bad. But esoteric items like configuring policies like row level security? This was new to me. You may have to contend with this depending on what vector store database service you choose.
  • Insert Testing: When you first start doing inserts, be aware that you’ll keep adding rows, even if doing the same data over and over. So for initial testing, you can do this, but you’re better off deleting your data each time. Or, as I did, add a test to see if something already exists. For new info, you’ll use “Upsert” which will insert a new row for new data. If you fail to do this, you’ll likely end up with loads of duplicate data. Besides potentially messing up the math for vector calculations, this may end up just creating larger and larger token submissions over time, burning time and tokens in your GPT of choice. This could cause expenses to start spiraling up for no good reason.
  • GPT Tag Team: I found that different GPTs were good at different things. So I’d use multiple GPTs, often at the same time in different windows. My helpers were in a different browser, with several tabs. One would be asked to build some HTML to embed a chatbot UX for WordPress, while another worked on a code formatting problem with a node. Gemini, for example, is pretty good with step by step instructions, but it’s formatting of responses is maddening frequently requiring scrolling up to find the beginning. Claude seemed really crisp. Sometimes it was better to try multiple GPTs for the same problem; similar to getting a second opinion from a doctor. Sometimes they’d agree, sometimes not.
  • Do the Early Tutorials: Whether it’s n8n, Supabase or whatever, there are 6.8 #$$^ tons of tutorials out there. Do some of the basics. The UI/UX on some of these things has some vagaries. The time is well spent to avoid some of the pitfalls. Just be the internet geek that you are and slap on some headphones with your laptop while your SO is watching America’s Got Talent or something and learn where to get your service role API keys and such. You’ll be glad you did.
  • Get it Done. Or Understand: There are two ways to use GPTs for this sort of thing. The first way is to just slap in whatever they tell you to do. The second is to follow along, and try to understand their explanations. If you do the latter, you may find you’re kind of learning a lot – including how to code some things – almost by accident. Because you’re not sitting there just “learning to code.” You’re seeing “how this one thing” works. Over time, those things flow together.

Filed Under: Product Management, Tech / Business / General, UI / UX

Recent Posts

  • Fear of Agent Rot: Lobotomies in Smart Systems
  • Adding a GPT with RAG to a WordPress Site
  • AI GPT Safety & Issues for Kids
  • Comparison Site Build: WordPress vs. AI Builder
  • Solving Physical Risks of Holding Crypto

Categories

  • Analytics
  • Book Review
  • Marketing
  • Product Management
  • Tech / Business / General
  • UI / UX
  • Uncategorized

Location

We're located in Stamford, CT, "The City that Works." Most of our in person engagement Clients are located in the metro NYC area in either New York City, Westchester or Fairfield Counties, as well as Los Angeles and San Francisco. We do off site work for a variety of Clients as well.

Have a Project?

If you have a project you would like to discuss, just get in touch via our Contact Form.

Connect

As a small consultancy, we spend more time with our Clients' social media than our own. If you would like to keep up with us the rare times we have something important enough to say via social media, feel free to follow our accounts.
  • Facebook
  • LinkedIn
  • Twitter

Copyright © 2025 · TetraMesa, LLC · All Rights Reserved