This tutorial demonstrates how to use InfraNodus to optimize your AI knowledge context for ChatGPT, Open-WebUI, or complex agentic workflows so that they provide better responses.
Most of the time, when you query your favorite LLM without providing additional context, you will get very generic responses and lots of hallucinations. The reason is that, by default, an LLM is using everything that it has learned to provide the response for you.
So what people do to increase precision is to upload the “context” or a “knowledge base,” which can be a collection of documents, and ask LLM to be focused on that particular context when it generates responses.
There are multiple ways of doing that. You can upload a batch of PDF files in ChatGPT Projects, you can upload them to Open-WebUI workspaces, or you can even create a complex workflow (e.g. in Dify) where your AI agent will use RAG (retrieval augmented generation) to find the closest matches to the user’s query and to add them to the additional prompt to generate good results.
But all of this is a black box for you as a user.
How do you know that the files you gathered are actually of good quality and that they cover the topic in their entirety?
How do you know what questions to ask?
Do you really trust that your model will extract the most relevant bits to your query?
These are all very important questions, and in this tutorial, I’m going to demonstrate a really good solution to all of them.
This video demonstrates this workflow step by step. It has useful timecodes you can use to jump to the most relevant topics:
Here are the main steps that you can follow to achieve the same results:
Step 1: Convert Your Knowledge Base into a Knowledge Graph
Using the InfraNodus text network analysis tool, we will visualize the content of your PDF files or knowledge base, identify the main topics and the gaps inside, and provide a really good high-level overview of the content.
This representation is also very objective because it uses a peer-reviewed algorithm to represent your data. It doesn’t miss anything like AI would.
Step 2: Get an Overview of Your Knowledge Base and Optimize It
You can use this representation to see if you’re missing any important topics. Even ask InfraNodus if anything else can be added. If you discover that something is missing, you can add more data to your knowledge base.
For example, if you upload a collection of papers on GraphRAG, you can run a Google Scholar or Arxiv search on "GraphRAG" inside InfraNodus itself, build another graph, then compare the two to see what topics in the general scientific discourse on "GraphRAG" are missing in your knowledge base.
You can also use this representation to estimate the quality of your AI responses or RAG workflows.
Step 3: Add the Knowledge Graph Insights into Your AI Prompts (manually or via API)
To improve the responses you get from the AI system, you can add the main topics and various other knowledge graph insights into your system prompt. That will help the AI provide higher-quality responses, especially for general queries.
InfraNodus generates a system prompt for you, which you can then import into your favorite tool, like Dify, Open-WebUI, or ChatGPT:
You can also access this graph summary via the InfraNodus API `graphAndAdvice` or `dotGraphFromText` endpoints. Both of them have the `graphSummary` response which contains the topical summary above. It can be integrated into your LLM workflows.
For instance, see an article here for an example of the API implementation with Dify where we use this graph summary to improve the original user queries to our support portal chatbot:
Using InfraNodus API to Augment Your AI RAG Prompts with the Knowledge Graph Insights (Dify example)
(example: if the user asks "What is it about", we'll get the additional graphSummary information and change this question into something like "What can InfraNodus text analysis tool to do help users detect structural gaps and get insights about text data")
Step 4: Generate Research Questions to Bridge Content Gaps
Finally, you can also use InfraNodus to generate interesting questions and prompts to ask about this content and to develop it further.
They will focus on the gaps detected in the knowledge base between the topics that could be better connected. Bridging those gaps will optimize the structure of the context you're working with.
This functionality is also accessible via the graphAndAdvice API endpoint.
You can see its real-life implementation in this support article where we show how we use it to question the news of the day and send interesting ideas via a Telegram bot and via the RapidAPI endpoints:
Using InfraNodus API to Generate Questions for Any Text
Step 5: Analyze Your LLM Knowledge Base Structure with Network Analysis
You can use network analysis insights to optimize the structure of your LLM knowledge base. InfraNodus calculates the topical diversity score based on several metrics: community structure, distribution of the most influential nodes across the different topics, concentration of influence in a single topic.
If the knowledge base is too biased on a specific topic, this is an indicator that the peripheral topics could be enhanced with more information.
If the knowledge base is too dispersed, this is an indicator that the knowledge base could be optimized by connecting the topics better to each other with more content.
The logic follows the cognitive variability framework and the measure is accessible in the Analytics > Main Topics panel or in the Analytics > Structure (advanced mode):
Comments
0 comments
Please sign in to leave a comment.