Skip to main content
RAG only currently works with the model template we provided. Any other templates are still being tested thoroughly.

Why use RAG?

RAG gives your NPCs and AI systems access to scalable, high-quality knowledge without bloating context or hurting performance. With RAG, you can store large amounts of world lore, quest details, item descriptions, character histories, or any custom knowledge outside the live LLM context. At runtime, GladeCore automatically retrieves only the most relevant passages and injects them into the model’s prompt, keeping responses accurate, consistent, and grounded in your game world.

Step 1: Setup RAG Data Asset

There are two demo data assets for each of the NPCs. You can look at each of them to get an idea of what you can do with the RAG system. UE RAG NPC DA Files Pn Below is a view inside the RAG data asset where each Passage index is data that is not directly stored in system context but can be referenced at runtime through context injection of RAG with relevant user input to passage similarity.  UE RAGDA Asset Example Pn This means users can ask Lucious, for example, what “emberwake” is and he knows without having it stored directly in context history. Instead it can sit in RAG and be referenced when the player asks about it. If using an external file, make sure you fill out your passages in as a CSV matching the name of the External CSV JSON that becomes editable when the use external file = true. Place your CSV in the folder path Plugins → GladeCore → Source →ThirdParty → LinkGGML → Models (image below). UE RAG CSV Folder Path Pn

Step 2: Apply the RAG Data Asset

Next, apply the RAG Data Asset to the NPC Data Asset for the respective character into the RAG → NPCRag Data field so that the new RAG data asset you made is now applied to the NPC. UE Apply RAG DA To NPC Pn

Step 3: Adjust RAG Settings

Find the editable LLMServiceManager inside the GladeCoreComponent on the player. Focus on the section that includes RAG. If you want a different embedding model for your RAG you are welcome to download a new one and place the file pathing here. We recommend placing it in the models folder so that it builds with packaged builds.  UE RAG LLM Service Manager Settings Pn To enable RAG keep Using RAG checked. Auto Reseed on Persona Swap is important because it swaps the RAG between NPCs. This is important because it causes one embed instance to run and swap instead of multiple.  RAGTop K means how many top results you want it to grab. So if you want it to grab the best 3 if it finds 3 good results then it will insert all 3. We recommend keeping this lower as it fills the context of each message it matches. RAGMax is in case it pulls too many from multiple passages. RAGMin Cos is for passage ranking purposes. If RAG is ranking the passage too high or pulling too many passages that are irrelevant, raise RAGMin Cos and play around with it so that it requires a higher vector similarity score.