RAG Retriever

AI Toolkit rag_retriever Professional

Retrieve relevant documents from knowledge collections using RAG with optional AI query optimization

Overview

The RAG Retriever finds relevant information from knowledge collections and stores the results in a variable for use in subsequent nodes.

How It Works

  1. Process Query: Renders your search query with Handlebars variables (e.g., {{user_message}})
  2. Search: Executes the search across your selected knowledge collections
  3. Store Results: Saves the search results in a variable
  4. Route: Continues through "Results Found" or "No Results" based on whether anything was found

AI Query Optimization

Optionally enable AI to generate and test multiple optimized search queries, then evaluate and filter the results for relevance.

Output Variable

The search results are stored with content, scores, and metadata:

Results: {{rag.results[0].content}}
Count: {{rag.count}}

Configuration Fields

Search Query handlebars Required

The search query to find relevant documents.

Show details

Supports Handlebars syntax:

{{variable_name}}
Knowledge Collections knowledge_collections Required

Select one or more knowledge collections to search.

Show details

Select one or more knowledge collections to search. Collections are managed in the Knowledge section.

Search Settings search_settings

Configure search behavior and result filtering.

Show details

Configuration options:

  • Search type (hybrid, semantic, keyword)
  • Result limit (1-50)
  • Quality score threshold
  • Similarity threshold

Search types:

  • Hybrid: Combines semantic and keyword matching for best results
  • Semantic: Finds conceptually similar content using AI embeddings
  • Keyword: Traditional exact/fuzzy text matching
AI Query Optimization toggle

Enable AI-powered query optimization. When enabled, AI generates multiple optimized search queries, searches with all of them, merges results, and uses AI to evaluate and filter results for relevance. This improves search quality for complex queries but adds latency.

agenticOptimization toggle

AI Query Optimization

Enable AI-powered query optimization. When enabled, AI generates multiple optimized search queries, searches with all of them, merges results, and uses AI to evaluate and filter results for relevance. This improves search quality for complex queries but adds latency.

Default: false
AI Configuration agent_settings

Configure the AI model and behavior.

Show details

Configuration options:

  • AI model selection
  • Temperature (0.0-2.0) - Higher = more creative, Lower = more consistent
  • Conversation context length - Amount of chat history to include
  • Personality instructions - Defines how the AI interacts

Temperature guide:

  • 0.0-0.5: Focused, deterministic, predictable
  • 0.5-1.0: Balanced between creativity and consistency
  • 1.0-2.0: Creative, varied, exploratory

Output Variables

This node stores its output in a variable that can be referenced in subsequent nodes using the {{variable}} syntax.

{{variable}}.results array

Array of search result objects with content, score, source, and metadata

{{variable}}.results[].id string

Unique identifier for the search result chunk

{{variable}}.results[].content string

The text content of the search result chunk

{{variable}}.results[].score number

Relevance score for this result (0.0-1.0)

{{variable}}.results[].source string

Source document name or URL

{{variable}}.results[].metadata object

Additional metadata about the search result

{{variable}}.results[].collection_id string

ID of the collection this result came from

{{variable}}.results[].collection_name string

Name of the collection this result came from

{{variable}}.query string

Original search query that was executed

{{variable}}.count number

Number of results returned

{{variable}}.metadata object

Search metadata including total_count, search_type, and timestamp

{{variable}}.metadata.total_count number

Total number of results found (same as count)

{{variable}}.metadata.returned_count number

Number of results returned (same as count)

{{variable}}.metadata.search_type string

Search type used: hybrid, semantic, or keyword

{{variable}}.metadata.timestamp string

ISO 8601 timestamp when search was executed

Connection Points

Input
Accepts incoming connections from other nodes
✓ Results Found output
Search returned one or more relevant results
∅ No Results empty_results
Search completed but found no matching results

More in AI Toolkit