AI Search
AI-generatedOverview
This node enables querying Cloudflare AutoRAG knowledge bases using AI-powered semantic search. It retrieves relevant information from your indexed documents and can generate context-aware responses by leveraging large language models. This is particularly useful for building chatbots, documentation search tools, or retrieval-augmented generation (RAG) applications where you want to combine precise document retrieval with AI-generated answers.
Typical use cases include:
- Asking detailed questions about your product or service documentation.
- Building conversational agents that provide accurate, sourced answers.
- Searching large knowledge bases with AI-enhanced query rewriting and result ranking.
For example, you could ask: "What are the key features of Workers AI?" and get a synthesized answer based on the most relevant document chunks retrieved from your knowledge base.
Properties
| Name | Meaning |
|---|---|
| AutoRAG Name | The unique identifier of your AutoRAG instance (knowledge base) in Cloudflare. This corresponds to the name you assigned when creating the AutoRAG in the Cloudflare dashboard. |
| Query | The question or search query you want to ask your knowledge base. Be specific and clear to improve the quality of results. Examples: "How do I configure authentication?" or "What are the pricing tiers?" |
| Model | (AI Search only) The text generation model used to create responses. If left empty, the default model configured in your AutoRAG settings will be used. Example values: @cf/meta/llama-3.3-70b-instruct, @cf/mistral/mistral-7b-instruct. |
| Rewrite Query | Whether to optimize (rewrite) the query for better semantic search results. When enabled, the AI reformulates your query to improve retrieval accuracy, which is helpful for ambiguous or conversational queries. |
| Result Limit | Maximum number of document chunks to retrieve (1-50). More results provide more context but may increase response time. Use 3-5 for quick answers, 10-20 for comprehensive responses. |
| Minimum Score | Minimum similarity score threshold (0.0-1.0) for including results. Higher values (0.7-0.9) return only very relevant matches; lower values (0.3-0.5) include more diverse results. Use 0 to include all up to the limit. |
Output
The node outputs an array of JSON objects, each representing the response for one input item. Each output object includes:
- The full API response from Cloudflare AutoRAG, containing either:
- For AI Search: A synthesized AI-generated answer along with the retrieved document chunks providing context.
- For Search: Raw document chunks matching the query without AI generation.
- Metadata fields:
operation: The operation performed (aiSearchorsearch).autoRagName: The name of the queried AutoRAG knowledge base.requestedQuery: The original query string sent.
If an error occurs and the node is set to continue on failure, the output will contain an error field describing the issue alongside the above metadata.
The node does not output binary data.
Dependencies
- Requires a valid Cloudflare AutoRAG API credential with appropriate permissions.
- The node makes authenticated HTTP POST requests to the Cloudflare AutoRAG API endpoint.
- You must configure the API credential in n8n with your Cloudflare account details and API token.
- No additional external dependencies beyond the Cloudflare API and n8n's HTTP request helper.
Troubleshooting
Common issues:
- Invalid or missing API credentials will cause authentication errors.
- Incorrect
AutoRAG Namewill result in "not found" or similar API errors. - Providing an invalid model name may cause the API to reject the request.
- Setting overly restrictive
Minimum Scoreor too lowResult Limitmight yield no results. - Network connectivity problems can cause request failures.
Error messages:
- Errors returned by the Cloudflare API are captured and included in the node's error output.
- Typical error message examples:
"Invalid API token": Check your API credential configuration."AutoRAG instance not found": Verify theAutoRAG Nameis correct."Model not supported": Use a valid model name or leave blank to use default.
- To resolve, verify credentials, parameter values, and network access.