{"id":12789,"date":"2024-10-17T08:54:22","date_gmt":"2024-10-17T06:54:22","guid":{"rendered":"https:\/\/www.juust.org\/?p=12789"},"modified":"2024-10-17T09:26:48","modified_gmt":"2024-10-17T07:26:48","slug":"free-rag-pt2-the-workflow-in-wp","status":"publish","type":"post","link":"https:\/\/www.juust.org\/index.php\/free-rag-pt2-the-workflow-in-wp\/2024\/10\/","title":{"rendered":"Free Rag pt2 : the workflow in WP"},"content":{"rendered":"\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#mini-scrum\">Mini-Scrum<\/a><\/li><li><a href=\"#tuesday-part-1\">Tuesday : part 1<\/a><\/li><li><a href=\"#wednesday-part-2\">Wednesday : part 2<\/a><\/li><li><a href=\"#theorize-mister-data\">Theorize, mister Data&#8230;<\/a><\/li><li><a href=\"#conclusion-rag-4-wp\">Conclusion : Rag 4 WP<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<p>I\u2019ve got the flu, so I\u2019m pretty much a useless lump right now. I spent the whole morning tuesday feeling bored and chewing on my bottom lip, so I thought, \u201cWhy not try porting the <a href=\"https:\/\/www.juust.org\/index.php\/build-a-free-rag-system-with-n8n\/2024\/09\/\">&#8216;Free Rag&#8217; N8N template<\/a> to PHP and integrating it into WordPress?\u201d Let&#8217;s turn WordPress into a RAG system !<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"mini-scrum\">Mini-Scrum<\/h3>\n\n\n\n<p>I am not up to working, but I managed to get something done, using a kind of \u201cmini-scrum\u201d approach: 30 minutes of focus and coding, followed by an hour of relaxation and recovery. Reading API docs, mainly, thinking about it.<\/p>\n\n\n\n<p>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. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"tuesday-part-1\">Tuesday : part 1<\/h3>\n\n\n\n<p>I threw the idea at ChatGPT, and it loved it! It immediately spat out a \u201c4-step plan.\u201d<\/p>\n\n\n\n<p>When I saw the plan, I thought, \u201cThere\u2019s no way it\u2019s going to be that easy.\u201d And of course, it wasn&#8217;t that easy, most of the code didn\u2019t work\u2026 so I spent the whole afternoon in my mini-scrum mode, reading API documentation and figuring out how things like the <a href=\"https:\/\/huggingface.co\/\" data-type=\"link\" data-id=\"https:\/\/huggingface.co\/\" target=\"_blank\" rel=\"noopener\">Huggingface<\/a> and <a href=\"https:\/\/api.qdrant.tech\/api-reference\" target=\"_blank\" rel=\"noopener\">Qdrant API <\/a>work. <\/p>\n\n\n\n<p>These are things I still needed to learn in depth, there is definitely a learning curve there. But that&#8217;s all good. Knowledge and experience are good. That\u2019s where the mini-scrum method came in handy\u2014an hour of reading and studying and thinking, followed by 30 minutes of coding. <\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-7.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"647\" height=\"555\" src=\"https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-7.png\" alt=\"N8N Free Rag in WordPress\" class=\"wp-image-12791\" srcset=\"https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-7.png 647w, https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-7-300x257.png 300w\" sizes=\"(max-width: 647px) 100vw, 647px\" \/><\/a><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p>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 &#8216;point&#8217; in qDrant. I wanted to go to bed at 9 PM so I figured that was it for the day.<\/p>\n<\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"wednesday-part-2\">Wednesday : part 2<\/h3>\n\n\n\n<p>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?<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p> I gave ChatGPT a text description of part 2 of the N8N template, and once again, it cheerfully generated another \u201c4-step plan\u201d (it\u2019s always so upbeat :) ). <\/p>\n\n\n\n<p>I thought, \u201cOh dear, here we go again\u2014four deceptively simple steps, and I\u2019ll probably still be working at this by 8 PM\u2026\u201d<\/p>\n\n\n\n<p>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\u2019t introduce any new API&#8217;s, so it might not cost that much effort. <\/p>\n\n\n\n<p>Let&#8217;s give it a try, mini-scrum !<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-8.png\"><img decoding=\"async\" width=\"697\" height=\"567\" src=\"https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-8.png\" alt=\"N8N Free Rag in WordPress : augmented retrieval\" class=\"wp-image-12792\" srcset=\"https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-8.png 697w, https:\/\/www.juust.org\/wp-content\/uploads\/2024\/10\/afbeelding-8-300x244.png 300w\" sizes=\"(max-width: 697px) 100vw, 697px\" \/><\/a><\/figure>\n<\/div>\n<\/div>\n\n\n\n<p>So, I jumped back into mini-scrumming. <\/p>\n\n\n\n<p>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\u2019s progress and decided it was time to rest and let the flu run its course. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"theorize-mister-data\">Theorize, mister Data&#8230;<\/h3>\n\n\n\n<p>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 &#8216;suggests&#8217; bananas and chocolate sauce, strawberries, all the stuff that goes GREAT with yoghurt. Then you use the &#8216;vector similarity search&#8217; to its full potential. That&#8217;s a possible moneymaker. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"conclusion-rag-4-wp\">Conclusion : Rag 4 WP<\/h3>\n\n\n\n<p>It&#8217;s a tentative &#8216;go&#8217;. 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\u2019t need to mess with difficult math functions and all kinds of math and vector libraries\u2014it\u2019s all handled by the services, through their API&#8217;s.  <\/p>\n\n\n\n<p>Finally integrating it into WordPress will be some work, but I think in two or three weeks I&#8217;ll have a working system.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I ported the N8N Free Rag template to PHP in order to turn my Wordpress blog into a RAG machine&#8230;<\/p>\n","protected":false},"author":5796,"featured_media":12799,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[484,4,11,13],"tags":[483,100],"class_list":["post-12789","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-juust","category-seo-tool","category-wordpress","tag-ai","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/posts\/12789","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/users\/5796"}],"replies":[{"embeddable":true,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/comments?post=12789"}],"version-history":[{"count":4,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/posts\/12789\/revisions"}],"predecessor-version":[{"id":12803,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/posts\/12789\/revisions\/12803"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/media\/12799"}],"wp:attachment":[{"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/media?parent=12789"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/categories?post=12789"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.juust.org\/index.php\/wp-json\/wp\/v2\/tags?post=12789"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}