Examples
Five FlowRag configurations covering knowledge insertion, policy Q&A, support FAQ, metadata-filtered query, and a complete RAG pipeline pattern.
Example 1: Insert HR Policy into Knowledge Base
{
"credential_id": "pgvector-prod",
"operation": "insert",
"collection_name": "hr-policies",
"item_id": "policy-remote-work-v4",
"knowledge_item": "Employees are eligible for remote work up to 3 days per week after completing 90 days of employment. A minimum of 2 days per week must be spent in the office. Remote work requires manager pre-approval via the HR portal and a compliant home office setup meeting BizFirst ergonomic standards.",
"metadata": {
"category": "hr",
"policy_type": "remote-work",
"department": "all",
"version": "4",
"effective_date": "2025-01-01",
"status": "active"
}
}
Expected outcome: Policy text is embedded and stored. Future queries asking about remote work, WFH policies, or office attendance will retrieve this item with high similarity scores.
Example 2: Employee Policy Q&A Query
{
"credential_id": "pgvector-prod",
"operation": "query",
"collection_name": "hr-policies",
"query": "{{ vars.employee_question }}",
"top_k": 4,
"min_score": 0.75,
"metadata_filter": {
"status": "active",
"department": "{{ vars.employee_department }}"
}
}
Expected outcome: Top 4 active, department-relevant policy items returned. The
context_text output is injected into an HTTP Request node calling Claude with the employee's question for a precise, policy-grounded answer.Example 3: Support FAQ Retrieval with Score Filtering
{
"credential_id": "pgvector-prod",
"operation": "query",
"collection_name": "support-faqs",
"query": "{{ vars.ticket_description }}",
"top_k": 3,
"min_score": 0.80,
"metadata_filter": {
"product": "{{ vars.product_name }}",
"status": "published"
}
}
Expected outcome: If
result_count > 0, the top FAQ is used to generate a direct response (skipping the full AI generation step). If no FAQs meet the threshold, the workflow routes to the full AI generation path.Example 4: Update Outdated Knowledge Item
{
"credential_id": "pgvector-prod",
"operation": "update",
"collection_name": "hr-policies",
"item_id": "policy-remote-work-v4",
"knowledge_item": "Effective July 2025, employees may work remotely up to 4 days per week after completing 30 days of employment. One mandatory in-office day per week is required for all employees. Remote work days must be recorded in the HR portal by 8am on the day of remote work.",
"metadata": {
"category": "hr",
"policy_type": "remote-work",
"department": "all",
"version": "5",
"effective_date": "2025-07-01",
"status": "active"
}
}
Expected outcome: The knowledge item is re-embedded with the new text. Future queries about remote work will retrieve the updated policy — no retraining required. Old version's similarity pattern is replaced immediately.
Example 5: Complete RAG Pipeline — Legal Contract Clause Lookup
Step 1 — FlowRag Query:
{
"credential_id": "qdrant-legal",
"operation": "query",
"collection_name": "contract-library",
"query": "{{ vars.lawyer_query }}",
"top_k": 5,
"min_score": 0.72,
"metadata_filter": {
"contract_type": "technology",
"status": "executed"
}
}
Step 2 — HTTP Request to Claude (downstream node):
{
"url": "https://api.anthropic.com/v1/messages",
"method": "POST",
"auth_type": "bearer",
"auth_credentials": { "credential_id": "anthropic-api" },
"body": {
"model": "claude-opus-4-5",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": "You are a legal research assistant. Using the contract clauses below, answer the lawyer's query.\n\nRelevant contract clauses:\n{{ nodes.ragLegal.output.context_text }}\n\nQuery: {{ vars.lawyer_query }}\n\nCite the specific clause IDs in your response."
}]
}
}
Expected outcome: Claude receives the 5 most relevant contract clauses as context and generates a precise legal research response with specific clause citations — far more accurate and grounded than a general LLM response without RAG context.
Example 6: Delete Superseded Knowledge Item
{
"credential_id": "pgvector-prod",
"operation": "delete",
"collection_name": "product-catalog",
"item_id": "product-legacyXR-specs"
}
In practice, use a Loop node to delete multiple items when retiring a set of related knowledge items (e.g. all entries for a discontinued product line). Alternatively, update metadata to status: deprecated and use metadata_filter in queries to exclude them — this preserves the historical data while hiding it from active queries.
Example 7: Bulk Insert from a Workflow Variable Array
// Use a Loop node with items: $node.pdfParser.sections
// Each iteration runs FlowRag insert with:
{
"credential_id": "pgvector-prod",
"operation": "insert",
"collection_name": "policy-documents",
"item_id": "{{ vars.document_id }}-section-{{ loop.index }}",
"knowledge_item": "{{ loop.item.text }}",
"metadata": {
"document_id": "{{ vars.document_id }}",
"document_title": "{{ vars.document_title }}",
"section_number": "{{ loop.index }}",
"section_heading": "{{ loop.item.heading }}",
"page_number": "{{ loop.item.page }}",
"ingestion_date": "{{ vars.today }}"
}
}
Chunk size guidance: Split documents into sections of 200–500 tokens for best retrieval quality. Very long sections dilute the embedding — the vector captures a blended average of all the section's topics, reducing precision. Very short sections (one sentence) often lack enough context to retrieve correctly. Paragraph-level chunks with a descriptive heading as metadata tend to work best.
Summary: Operation Selection Guide
| When you want to… | Use operation |
|---|---|
| Add a new document, policy, or FAQ entry | insert |
| Update a changed policy or product description | update |
| Remove a discontinued or superseded entry | delete |
| Find relevant content for an AI prompt | query |
| Check if a document already exists before inserting | query with min_score: 0.95 and the document title as query |
| Refresh all items in a collection | Loop over items → update each |