Dify, the versatile open-source LLM app studio, empowers users to build sophisticated AI applications. This guide explores an advanced integration using InfraNodus to create AI Q&A chatbots that don't just answer questions, but also uncover insights and generate novel ideas directly from your knowledge base.

Imagine feeding your knowledge base (research papers, website content, support docs) into InfraNodus to visualize it as a knowledge graph. InfraNodus excels at identifying 'structural gaps' – areas where concepts aren't well-connected. Its API can then generate insightful questions or prompts targeting these gaps.
You can seamlessly integrate this capability into your Dify application. Use these generated questions as:
Engaging conversation starters for your chatbot users.
Springboards for content development, identifying areas needing further exploration or documentation.
Intelligent prompts for your Dify AI agents to brainstorm or ideate based on existing information.
This allows you to embed an enhanced chatbot on any website via Dify, providing users with unique ways to interact with your information or even triggering more complex workflows where InfraNodus-generated questions fuel further AI processing within Dify. This technique is powerful for stimulating new ideas from research collections or identifying potential business opportunities based on internal or competitor data.
Here’s the integration process:
Step 1: Visualize Your Knowledge with InfraNodus
First, ingest your content into InfraNodus. For this example, we used the content from here. You can use InfraNodus's built-in URL importer or tools like Firecrawl to scrape site data into Markdown (MD) files for import.
This process generates a knowledge graph representation of your content.

This graph provides a unique visual overview of your knowledge base, revealing key concepts, their relationships, and crucial gaps – insights often missed by standard RAG systems.
Step 2: Optimize the Graph for Deeper Insights
Before integration, it's often beneficial to refine the knowledge graph. In InfraNodus's Analytics Panel, check the Topical Diversity metric. If it's 'Low', the graph might be too focused on overly general concepts (like "graph" or "infranodus" in this example), leading to generic AI responses.
Optimize by selecting and removing these dominant, overly broad nodes. Add them to the permanent stopwords list to prevent their recurrence.


This refinement shifts focus to the more specific, underlying topics, resulting in a graph with better ("Focused") topical diversity, ready for generating more nuanced insights.
Step 3: Integrating InfraNodus into Your Dify Chatbot Workflow
Now, let's build the workflow within Dify. You can use Dify Cloud or deploy your own instance (e.g., via Elest.io).
Navigate to Studio > Chatbot > Create Blank to start your advanced chatbot.
The core workflow logic will be:
Start Node: Initiates the conversation. We'll use Dify's "Conversation Opener" feature to offer an auto-generated question.
Conditional Routing (IF/ELSE Node): Checks if the user clicked "Generate a Question".
If Yes: Triggers an HTTP request to the InfraNodus API to generate a question based on knowledge graph gaps.
If No (User types a query): Forwards the user's input to an information retrieval mechanism.
Information Retrieval: The user's query (or the auto-generated question) is processed to find relevant information. (We'll discuss two options below).
Response Generation: Dify's LLM generates an answer based on the retrieved information.
Continuation: The user can continue the dialogue, asking follow-up questions.

Implementation Details:
You can fast-track setup by importing a pre-built workflow using Studio > Import from YML file.
Option A (InfraNodus GraphRAG for Q&A): Uses InfraNodus for both question generation and answering. Provides potentially richer, graph-aware responses but may be slightly slower.
Option B (Dify RAG for Q&A): Uses InfraNodus only for question generation. User queries are handled by Dify's native RAG using a knowledge base you create within Dify. This is typically faster but requires setting up a Dify knowledge base.
Choose the workflow that best suits your needs. Below are the key setup steps:
Sub-step 3.1: Setting up the InfraNodus Question Generation (HTTP Request Node)
Add an HTTP Request node configured to call the InfraNodus graphAndAdvice API endpoint for question generation.
Method: POST
URL (include query parameters)
Body (JSON):
Sub-step 3.2: Adding a 'Generate Question' Starter
In the chatbot's Features > Conversation Opener, add a Conversation Opener in the chat's Features panel that says "Generate a Question". When the chat opens to the end user, they will be able to click this button to automatically generate a question with InfraNodus. If they don't generate a question, they can ask a free-form question, which will be forwarded to InfraNodus as a prompt.
Sub-step 3.3: Routing User Input (IF/ELSE Node)
Add an IF/ELSE node after the Start node.
Condition: Check if the input variable sys.query (from the Start node) exactly matches your conversation starter text (e.g., " Generate an Insightful Question").
IF True: Route to the HTTP Request node (Sub-step 3.1).
IF False: Route to the chosen knowledge retrieval mechanism (Sub-step 3.4).

Sub-step 3.4: Handling User Queries
This is where you implement either Option A or Option B for answering questions.
a) Using Dify's RAG Knowledge Base:
Create a Knowledge Base in Dify and upload the same content used for the InfraNodus graph.
In the workflow's ELSE path, add a Knowledge Retrieval node linked to this Dify knowledge base. The user's query (sys.query) or the generated question (passed from the HTTP node) will be used to retrieve context.
(Optional) You can enhance this path further, perhaps by using another tool or LLM node to refine the user's query before it hits the Knowledge Retrieval node, as shown in another tutorial.

See the YML file for a complete example.
b) Using InfraNodus' GraphRAG:
Create a Custom Tool in Dify (Tools > Custom > Create Custom Tool).
Use the Import via OpenAPI Schema option and paste the schema definition for the InfraNodus graphAndAdvice endpoint. Configure authentication as needed.
In the workflow's ELSE path (and also receiving input after the question-generating HTTP node), add the newly created InfraNodus Custom Tool node. Pass the user's query (sys.query) or the generated question to this tool. This tool will handle both context retrieval and initial response generation based on the graph.


Note: For advanced parsing of the tool's response or potential performance tweaks (like caching results in variables), Variable Assigners, Convert, or Code nodes might be useful before the final Answer node. The provided YML file includes a pre-configured example with these details and is the recommended starting point.
Sub-step 3.5: Testing and Deployment
Test the workflow thoroughly:
Start the chat and click the "Generate Question" button. Verify a relevant question appears.
Copy that generated question and paste it back into the chat input. Verify you get a coherent answer based on your chosen RAG method (Dify or InfraNodus).
Ask your own open-ended questions and check the responses.
Continue the conversation with follow-ups.
Once satisfied, publish your Dify chatbot and embed it or share the link!
Use Cases
Integrate Dify and InfraNodus for:
Developing interactive chatbots for scientific discourse and research exploration.
Building internal brainstorming tools based on company knowledge bases.
Generating novel product or feature ideas by analyzing support tickets or user feedback.
Creating dynamic learning tools that prompt students based on gaps in course material.
Try It Live:
This integration showcases the power of Dify's flexible workflow combined with specialized external tools like InfraNodus, enabling you to build truly unique and insightful AI applications. Happy building!