Community Edition

Retrieval Augmented Generation (RAG) Configuration

SWIRL supports real-time Retrieval-Augmented Generation (RAG) out of the box, using result snippets and/or the full text of fetched result pages.

Configuring RAG

  1. Install SWIRL as described in the Quick Start Guide, including the latest Galaxy UI.

  2. Add the RAG configuration and credentials to the .env file.

OpenAI direct:

OPENAI_API_KEY='your-OpenAI-key'

Azure/OpenAI:

AZURE_OPENAI_KEY='your-Azure/OpenAI-key'
AZURE_OPENAI_ENDPOINT='your-Azure/OpenAI-endpoint'
AZURE_MODEL='your-Azure/OpenAI-model'
AZURE_API_VERSION='your-Azure/OpenAI-version'

Optional RAG Configurations:

## Additional model usage options
SWIRL_RAG_MODEL='gpt-4.1'
SWIRL_REWRITE_MODEL='gpt-4.1'
SWIRL_QUERY_MODEL='gpt-4.1'

## RAG token and results budgets (defaults are 3000 and 10, respectively)
SWIRL_RAG_TOK=25000
SWIRL_RAG_MAX_TO_CONSIDER=12

SWIRL Community supports RAG only with OpenAI and Azure/OpenAI. SWIRL Enterprise supports additional providers.

  1. Configure SearchProviders for RAG.

Modify the page_fetch_config_json parameter for each SearchProvider:

"page_fetch_config_json": {
    "cache": "false",
    "headers": {
        "User-Agent": "Swirlbot/1.0 (+http://swirl.today)"
    },
    "timeout": 10
}
  • Adjust timeout if needed.
  • Change User-Agent if required.
  • Authorize SWIRL to fetch pages from internal applications.

To override the timeout via the Galaxy UI, use:

http://localhost:8000/galaxy/?q=gig%20economics&rag=true&rag_timeout=90
  1. Restart SWIRL:
python swirl.py restart
  1. Run a search in the Galaxy UI:

http://localhost:8000/galaxy/?q=SWIRL+AI+Search
Results appear:
![Galaxy with RAG results ready for selection](images/swirl_40_community_rag.png)
  1. Manually select results for RAG (optional):

    • Click Select Items to enable manual selection.
    • Pre-selected results are SWIRL's best matches for RAG.
    • Check or uncheck results, sort, or filter.
    • Click Generate AI Response.
    • A spinner appears; results follow within seconds.

    Galaxy with RAG results selected

  2. Verify citations under the RAG response.

    {: .highlight }
    To cancel a RAG process, toggle Generate AI Summary off.

    {: .warning }
    By default, SWIRL's RAG uses the first 10 selected results (auto or manual). To adjust, set SWIRL_RAG_MAX_TO_CONSIDER in .env, as noted in the AI Search Guide.

SWIRL RAG Process

SWIRL AI Search Insight Pipeline

SWIRL's RAG workflow:

  1. Search — SWIRL sends the user's query to one or more SearchProviders, then aggregates and normalizes the results.
  2. Re-Rank — the last step of the search workflow re-ranks the aggregated, normalized results to find the most relevant across all sources.
  3. Review — SWIRL can present re-ranked results for review and optional adjustment before executing the rest of the workflow.
  4. Fetch — follows the result link and downloads the full text or dataset.
  5. Read — SWIRL extracts text from 1,500+ file formats, identifies the most relevant passages, and chunks the text for the next step.
  6. Prompt — SWIRL binds the chunked text to the appropriate prompt, connects to the configured LLM, sends the prompt, and waits for the response.
  7. Package — SWIRL compiles the results, prompt, and response and returns them as a single JSON package, ready for visualization in the Galaxy UI.

Enterprise RAG Support

  • SWIRL Community can fetch publicly accessible sources.
  • For RAG with enterprise services (e.g., Microsoft 365, ServiceNow, Salesforce, Atlassian) using OAuth2 and SSO, contact us for SWIRL Enterprise.

Preloaded RAG Configurations

The following SearchProviders come pre-configured for RAG:

API-Based RAG Processing

RAG processing is available via a single API call:

?qs=metasearch&rag=true

For details, see the Developer Guide.

Configuring Timeout Behavior

  • The default timeout is 60 seconds.
  • To modify the timeout and error message, update:
"ragConfig": {
    "timeout": 90,
    "timeoutText": "Timeout: No response from Generative AI."
},