A step-by-step tutorial to build a Retrieval-Augmented Generation chat system using Jinba Flow — from knowledge base setup to deploying a live chat interface
Use this file to discover all available pages before exploring further.
Build a fully functional AI chat system that answers questions using your own documents. This tutorial walks you through every step: creating a knowledge base, building a RAG workflow, and deploying it as a chat interface.
No coding experience is required. You can build the entire system using the chat panel or graph editor. The YAML manifests shown below are for reference and can be copied directly.
In your workspace sidebar, click Storage, then select the Knowledge Bases tab.
2
Create a New Knowledge Base
Click Create Knowledge Base. Enter a descriptive name (for example, “Product Documentation” or “Company FAQ”).
3
Note Your Knowledge Base ID
After creation, open your new knowledge base and confirm it appears in the list. In this tutorial, the example knowledge base is named RAG Tutorial KB.
# Step 1: Receive the user's question- id: user_question name: Receive Question tool: INPUT_TEXT input: - name: value value: ""# Step 2: Search the knowledge base for relevant content- id: search_knowledge name: Search Knowledge Base tool: JINBA_VECTOR_SEARCH config: - name: token value: "{{secrets.JINBAFLOW_WS_API_KEY}}" input: - name: query value: "{{steps.user_question.result}}" - name: knowledgeBaseId value: YOUR_KB_ID_HERE - name: topK value: 5 - name: threshold value: 0.3 needs: - user_question# Step 3: Generate an answer using the retrieved context- id: generate_answer name: Generate Answer tool: OPENAI_INVOKE config: - name: version value: gpt-4o input: - name: prompt value: | ## Instructions You are a helpful assistant. Answer the user's question based ONLY on the provided context. If the context doesn't contain the answer, say "I don't have enough information to answer that question." Always cite which source document(s) your answer comes from. ## Context (from knowledge base) {{steps.search_knowledge.results | dump}} ## User Question {{steps.user_question.result}} Please provide a clear, concise answer based on the context above. needs: - search_knowledge# Step 4: Output the answer- id: output_answer name: Output Answer tool: OUTPUT_TEXT input: - name: value value: "{{steps.generate_answer.result.content}}" needs: - generate_answer
Fastest path: paste the full YAML manifest above. If you prefer building flows visually, you can also add the four nodes manually in the editor and configure them one by one.
Alternative: Build the Flow Manually in the Editor
If you want to learn how each node is assembled visually, follow this manual path instead of pasting YAML.
1
Add the Input Text node
Open the node picker, search for Input Text, and add it as the first node in the graph.After adding it, rename the node to Receive Question so it matches the tutorial manifest.
2
Add and configure the Vector Search node
Click the + connector under the first node, search for Vector Search, and add the JINBA_VECTOR_SEARCH node.Then configure it with:
Token: JINBAFLOW_WS_API_KEY secret
Query: {{steps.user_question.result}}
Knowledge Base ID: your knowledge base ID
Top K: 5
Threshold: 0.3
3
Add and configure the OpenAI Invoke node
Add an Invoke node and choose OPENAI_INVOKE.Set the model version to gpt-4o, then paste the same prompt shown in the YAML example so the model answers only from retrieved knowledge base context.
4
Add and configure the Output Text node
Add an Output Text node as the final step.Rename it to Output Answer, and set its value to:
The INPUT_TEXT tool creates an input parameter for the flow. When executed manually, it shows a text box. When called via API, this becomes a parameter in the request body. Learn more about input tools.
This step performs semantic search — finding content by meaning, not just keywords.
Parameter
Value
Why
topK
5
Returns the 5 most relevant chunks
threshold
0.3
Filters out low-relevance results
The needs: [user_question] ensures the search waits for the user’s question before executing. See Step Module Options for more details.
Start with topK: 5 and threshold: 0.3. If answers lack context, increase topK. If irrelevant content appears, increase threshold. See the Vector Search reference for more guidance.
- id: generate_answer name: Generate Answer tool: OPENAI_INVOKE config: - name: version value: gpt-4o input: - name: prompt value: | ## Instructions You are a helpful assistant. Answer the user's question based ONLY on the provided context. If the context doesn't contain the answer, say "I don't have enough information to answer that question." Always cite which source document(s) your answer comes from. ## Context (from knowledge base) {{steps.search_knowledge.results | dump}} ## User Question {{steps.user_question.result}} Please provide a clear, concise answer based on the context above. needs: - search_knowledge
The | dump filter serializes the search results into the prompt so the LLM can read all retrieved chunks and their sources. Learn more about Variables & Templates.
Deploy your RAG flow as a chat connector in Jinba App for the simplest end-user experience.
1
Publish Your Flow
In the flow editor, click the Publish button. A dialog will ask “Who will trigger this workflow?”:
Option
Description
When to choose
My team
Simple interface anyone can use
✅ Choose this for the chat UI path (Option A)
Engineers
Call it from code via API
Choose this for the API path (Option B)
Automatic
Runs on schedule or when events happen
Choose this for scheduled/event-driven flows
Select My team and click Continue →.
2
Understand the Jinba Flow → Jinba App Relationship
After selecting “My team”, an education screen appears explaining that Jinba Flow (where you build) and Jinba App (where your team uses it) are separate products:
Separate products, by design — Jinba Flow is the builder; Jinba App is the chat interface your team uses
Enterprise-grade security — Jinba App has its own authentication and access controls
Simple for your team — No code, no complexity — just a familiar chat interface
Click Got it, continue to proceed to the MCP setup.
3
Enable MCP and Connect to Jinba App
The Create an MCP dialog appears. This shows a preview of how your flow will appear as a chat tool:
A chat preview showing @your_flow_name with a description
A Demo button to preview the chat experience
An Enable MCP for this flow toggle
You must turn on the Enable MCP for this flow toggle. This is what creates the connection between Jinba Flow and Jinba App — the “Connect with Jinba App” button only appears after you enable it.
Connect with Jinba App button — click this to open the connector in Jinba App
Enabling MCP also lets AI assistants (Claude, Cursor, etc.) call this flow as a tool — you get both Jinba App chat and MCP tool access with a single toggle.
After enabling MCP, you’ll be taken to the MCP → Connect tab. This page has several important sections:
Your Token — your workspace authentication token (keep this secret)
1-Click Connect — click Connect to instantly link this flow to Jinba App
Visibility — defaults to “Unlisted” (only users in your access rules can use it). Change to “Listed” if you want all workspace members to see it
Access Scope Settings — configure who can access this tool using JWT claims (e.g., email whitelist)
MCP Configuration JSON Snippet — copy this to use the flow in external MCP clients (Claude Desktop, Cursor, etc.)
You must click the 1-Click Connect button to make the flow available as a tool in Jinba App. Without this step, the tool won’t appear in Jinba App even though MCP is enabled.
Add your team members’ emails to the Access Scope Settings so they can also use this tool. Click + Add Rule to add more email rules.
Click the connectors icon (⚙️) at the bottom of the chat input
In the “Search agents and connectors…” dropdown, find your workspace’s MCP connector (e.g., “Tutorial Demonstrations MCP … 1 tool”)
Click into the MCP connector to see your RAG Chat Demo tool listed
Select the tool — it appears as a tag in the chat input bar
Type your question and press Enter
The tool runs automatically — you’ll see the Arguments (your user_question) and Result (the RAG response content) in an expandable section, followed by the AI’s formatted answer.
You can also use Auto Select mode — Jinba App will automatically choose the right tool based on your question, so you don’t need to manually select the connector each time.
Expose your RAG flow as an API endpoint for custom applications.
1
Publish Your Flow
Follow the same publish steps as above, but select Engineers in the “Who will trigger this workflow?” dialog instead. This optimizes the flow for API access.
2
Get Your API Key
After publishing, navigate to your flow’s settings to find the auto-generated API key.
3
Call the API
curl -X POST https://api.jinba.dev/api/v2/external/flows/{flow-id}/published-run \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "args": [ {"name": "user_question", "value": "What is your return policy?"} ], "mode": "sync" }'
Then adjust the generation step to use Pinecone’s output format:
- id: generate_answer name: Generate Answer tool: OPENAI_INVOKE config: - name: version value: gpt-4o input: - name: prompt value: | You are a helpful assistant. Answer based on the provided context. ## User Question {{steps.user_question.result}} ## Relevant Documentation {{steps.search_pinecone.result.matches | dump}} Answer accurately based on the documentation above. needs: - search_pinecone
For enterprise organizations already using the Azure ecosystem, Jinba Flow supports Azure AI Search as an external knowledge base backend. This option provides advanced indexing, semantic ranking, and integration with Azure Data Lake Storage Gen2.
Azure AI Search integration is an enterprise feature. Contact your Jinba administrator or the Jinba sales team to enable this for your workspace.
In your workspace settings, navigate to the External Knowledge Base configuration. You can connect in two modes:
Mode
When to Use
APIM Mode
Routes through Azure API Management — recommended for production
Direct Mode
Connects directly to Azure AI Search — simpler for development
2
Set Up Azure Resources
Ensure you have:
An Azure AI Search service with an index configured
Azure Data Lake Storage Gen2 for document storage
API keys or APIM subscription keys
An indexer configured to process uploaded documents
3
Upload Documents
Upload documents through the Jinba workspace UI. Files are automatically sent to Azure Data Lake Storage, and the configured indexer processes them into the search index.
4
Search in Your Flow
The search step uses the External Knowledge Base configuration from your workspace. The exact tool and parameters depend on your enterprise deployment.