Free Rag pt2 : the workflow in WP

RAG

I’ve got the flu, so I’m pretty much a useless lump right now. I spent the whole morning tuesday feeling bored and chewing on my bottom lip, so I thought, “Why not try porting the ‘Free Rag’ N8N template to PHP and integrating it into WordPress?” Let’s turn WordPress into a RAG system !

Mini-Scrum

I am not up to working, but I managed to get something done, using a kind of “mini-scrum” approach: 30 minutes of focus and coding, followed by an hour of relaxation and recovery. Reading API docs, mainly, thinking about it.

I had no clue if that was even possible, porting the N8N template. In N8N, you see all these cheerful shapes doing something with various settings, but I had no idea if it was heavily coded or not, if there were functions in the shapes. I decided to just try it and figure it out along the way.

Tuesday : part 1

I threw the idea at ChatGPT, and it loved it! It immediately spat out a “4-step plan.”

When I saw the plan, I thought, “There’s no way it’s going to be that easy.” And of course, it wasn’t that easy, most of the code didn’t work… so I spent the whole afternoon in my mini-scrum mode, reading API documentation and figuring out how things like the Huggingface and Qdrant API work.

These are things I still needed to learn in depth, there is definitely a learning curve there. But that’s all good. Knowledge and experience are good. That’s where the mini-scrum method came in handy—an hour of reading and studying and thinking, followed by 30 minutes of coding.

N8N Free Rag in WordPress

By 8 PM, I had finished part 1 of the N8N template: vectorizing documents. Without chunking for now. I just wanted to put my first ‘point’ in qDrant. I wanted to go to bed at 9 PM so I figured that was it for the day.

Wednesday : part 2

Yesterday, I felt absolutely miserable. But curiosity eventually got the better of me, and I decided to take another look. Part 2 of the template, the augmenten retrieval, how does that work, and how much work would this really be?

I gave ChatGPT a text description of part 2 of the N8N template, and once again, it cheerfully generated another “4-step plan” (it’s always so upbeat :) ).

I thought, “Oh dear, here we go again—four deceptively simple steps, and I’ll probably still be working at this by 8 PM…”

But then I realized: all the services I used, I already used in part 1, I had read the API documentation and gotten familiar with everything, I had working API calls. Part 2 didn’t introduce any new API’s, so it might not cost that much effort.

Let’s give it a try, mini-scrum !

N8N Free Rag in WordPress : augmented retrieval

So, I jumped back into mini-scrumming.

Two rounds later, by 11 PM, I had my first RAG responses! Yes! It was not much work at all. I was completely satisfied with the day’s progress and decided it was time to rest and let the flu run its course.

Theorize, mister Data…

I spent the rest of day fantasizing about what I could develop and build with this. Like a recommendation engine. Imagine processing all your WooCommerce products, and developing an AI recommendation engine ! So that, if misses Harris puts yoghurt in her basket, the system ‘suggests’ bananas and chocolate sauce, strawberries, all the stuff that goes GREAT with yoghurt. Then you use the ‘vector similarity search’ to its full potential. That’s a possible moneymaker.

Conclusion : Rag 4 WP

It’s a tentative ‘go’. I still have to integrate it into actual WordPress, I built the workflow in a single separate PHP codefile. Not in WordPress yet, just a basic workflow in PHP with CURL for a quick check if it is possible. And it is very well possible. The whole setup runs on a series of HTTP REST APIs. There is no heavy computation involved, and you don’t need to mess with difficult math functions and all kinds of math and vector libraries—it’s all handled by the services, through their API’s.

Finally integrating it into WordPress will be some work, but I think in two or three weeks I’ll have a working system.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top