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
-
Install SWIRL as described in the Quick Start Guide, including the latest Galaxy UI.
-
Add the RAG configuration and credentials to the
.envfile.
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.
- 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
timeoutif needed. - Change
User-Agentif 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
- Restart SWIRL:
python swirl.py restart
-
Run a search in the Galaxy UI:
- Open http://localhost:8000/galaxy/.
- Ensure the
Generate AI Responseswitch is off. - Search for:
http://localhost:8000/galaxy/?q=SWIRL+AI+Search
Results appear:

-
Manually select results for RAG (optional):
- Click
Select Itemsto 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.

- Click
-
Verify citations under the RAG response.
{: .highlight }
To cancel a RAG process, toggleGenerate AI Summaryoff.{: .warning }
By default, SWIRL's RAG uses the first 10 selected results (auto or manual). To adjust, setSWIRL_RAG_MAX_TO_CONSIDERin.env, as noted in the AI Search Guide.
SWIRL RAG Process

SWIRL's RAG workflow:
- Search — SWIRL sends the user's query to one or more SearchProviders, then aggregates and normalizes the results.
- Re-Rank — the last step of the search workflow re-ranks the aggregated, normalized results to find the most relevant across all sources.
- Review — SWIRL can present re-ranked results for review and optional adjustment before executing the rest of the workflow.
- Fetch — follows the result link and downloads the full text or dataset.
- Read — SWIRL extracts text from 1,500+ file formats, identifies the most relevant passages, and chunks the text for the next step.
- Prompt — SWIRL binds the chunked text to the appropriate prompt, connects to the configured LLM, sends the prompt, and waits for the response.
- 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."
},