One of AskWP’s core features is its approach to finding answers on your site. AskWP uses two modes depending on your LLM provider: agentic search for providers with tool support, and traditional keyword-based RAG as a fallback. Here is how both work under the hood.
The Problem with Vanilla LLMs
Large language models are trained on vast amounts of internet text, but they know nothing about your specific business, products, or services. If you connect a raw LLM API to your website, it will answer questions confidently — but the answers may be wrong, outdated, or completely fabricated. This is the hallucination problem.
Agentic Search
When using a provider with tool support (OpenAI, Anthropic, or OpenRouter), AskWP injects a compact index of all your published pages and posts into the system prompt — titles, paths, types, and dates. The AI then uses two built-in tools to find answers:
- search_website — Searches your WordPress content by keyword
- get_page — Reads the full rendered content of any page
This means the AI actively decides what to look up. It can review the site index, search for a topic, read a page, search again if needed, and read another page — all before composing its answer. Up to 6 rounds of tool use are supported per conversation turn, allowing complex multi-hop queries.
The result: answers grounded in your actual content, with the AI acting as a researcher rather than a guesser.
Fallback RAG
For providers without tool support (like Ollama), AskWP falls back to traditional keyword-based retrieval-augmented generation:
- Keyword extraction — AskWP extracts meaningful keywords from the visitor’s latest message, filtering out stop words and very short terms
- WordPress search — The keywords are used to query WordPress’s built-in search across your configured post types (pages, posts, products, etc.)
- FAQ matching — The keywords are also matched against FAQ entries you have defined in the admin panel
- Ranking — Search results are ranked by the number of keyword hits in the title and content
- Snippet extraction — The top results are trimmed to focused snippets around the matching keywords
- Context assembly — The current page context, search snippets, and FAQ matches are assembled into a structured context block
- Prompt injection — The context block is appended to the system prompt, giving the AI access to your content
Configuring Search Behavior
The RAG tab in the admin panel lets you control:
- Max search results — How many WordPress search results to include in fallback mode (default: 4)
- Max FAQ matches — How many FAQ entries to include (default: 2)
- Post types — Which content types to search (pages, posts, custom types)
- Snippet length — How many characters per search result snippet in fallback mode (default: 300)
In agentic mode, the AI controls its own search depth — these settings primarily affect the fallback RAG pipeline for providers without tool support.