AI SEO cannot only look at the keywords typed by users, because AI search may first generate its own search queries. In OpenWebUI’s default query generation prompt, the system is instructed to prioritize 1–3 broad and relevant queries and to lean toward search when useful information may be retrieved. This means the Discovery stage in AI search is not determined only by human-entered keywords. It is also shaped by system-generated queries.

AI SEO cannot only look at the keywords typed by users. Traditional SEO often assumes that content teams should optimize for the words users search. In AI web search or RAG-style flows, however, the system may first generate its own search queries and use those queries to retrieve candidate sources.

This is the second article in the OpenWebUI series. The previous article, How OpenWebUI helps us understand AI SEO: from query generation to citation, established the overall flow. It explained that AI search visibility is not a single ranking problem, but a process involving query generation, source retrieval, content processing, passage selection, and final citation.

This article analyzes only the first variable: query generation. This step directly affects Discovery, meaning whether a page enters the candidate source set. Even if your page ranks well for a specific keyword, it may still fail to appear if the AI actually searches a broader or different query.

If you have not read the earlier concept article, start with Why your SEO ranking does not matter to AI search. That article explains why ranking only covers part of the AI citation funnel, while this article focuses on query generation at the front of Discovery.

Query generation is the first search variable in AI SEO

Query generation is the first major variable in an AI search flow. It decides what the system actually searches, and therefore affects which pages can enter the candidate source set.

Traditional SEO keyword research usually begins with the words users type. Content teams collect search volume, ranking difficulty, and related terms, then decide which pages to create. This method still matters, but it does not fully explain AI search.

In AI web search, the user’s question may be only the input. The system may then generate executable search queries based on chat context, language, date, and information need. What affects Discovery is often that generated query set, not only the user’s original sentence.

As a result, query generation adds a layer of uncertainty to AI SEO. Whether content enters the candidate source set depends not only on whether the page matches human-entered keywords, but also on whether the system generates a search query that can find the page.

How OpenWebUI’s default prompt asks the system to generate queries

OpenWebUI’s DEFAULT_QUERY_GENERATION_PROMPT_TEMPLATE directly shows that the system analyzes the chat history before deciding whether to generate search queries. The original prompt is shown below:

"""### Task:
Analyze the chat history to determine the necessity of generating search queries, in the given language. By default, **prioritize generating 1-3 broad and relevant search queries** unless it is absolutely certain that no additional information is required. The aim is to retrieve comprehensive, updated, and valuable information even with minimal uncertainty. If no search is unequivocally needed, return an empty list.

### Guidelines:
- Respond **EXCLUSIVELY** with a JSON object. Any form of extra commentary, explanation, or additional text is strictly prohibited.
- When generating search queries, respond in the format: { "queries": ["query1", "query2"] }, ensuring each query is distinct, concise, and relevant to the topic.
- If and only if it is entirely certain that no useful results can be retrieved by a search, return: { "queries": [] }.
- Err on the side of suggesting search queries if there is **any chance** they might provide useful or updated information.
- Be concise and focused on composing high-quality search queries, avoiding unnecessary elaboration, commentary, or assumptions.
- Today's date is: {{CURRENT_DATE}}.
- Always prioritize providing actionable and broad queries that maximize informational coverage.

### Output:
Strictly return in JSON format:
{
  "queries": ["query1", "query2"]
}

### Chat History:
<chat_history>
{{MESSAGES:END:6}}
</chat_history>
"""

This prompt does not represent every AI search platform. Its value is that it provides an open-source, observable example of how the intermediate step of query generation can influence the search process that follows.

For AI SEO, the most important part of this prompt is not the JSON format. It is how the prompt defines search queries. The system is instructed to produce broad, relevant, and executable queries, while also considering chat history rather than only the user’s last sentence.

Four important AI SEO signals in this prompt

The first signal is that the system is instructed to prioritize 1–3 broad and relevant search queries. This suggests that AI search may not focus only on exact keywords. It may first try to retrieve more complete topic-level information. This affects Discovery. If a page only aligns with a narrow long-tail keyword but does not cover broader topic queries, it may rank in traditional search while still failing to enter the candidate set for AI-generated queries.

The second signal is that the system only returns an empty list when it is entirely certain that search will not help. In other words, under this default prompt, if external search may provide useful or updated information, the system leans toward generating queries. This does not mean every answer will search, and it does not mean every platform uses the same strategy. It does show that in this observable flow, once Web Activation happens, Discovery is quickly shaped by query generation quality.

The third signal is that the system analyzes chat history. The {{MESSAGES:END:6}} variable indicates that the system considers recent conversation context, not only the final user message. This affects how AI SEO should be tested. The actual search query may be shaped not only by the last sentence, but also by context established earlier in the conversation. Tracking a single keyword may not fully simulate how AI search behaves.

The fourth signal is that the output must be an executable query list. The prompt requires the system to return JSON with a queries array. This means a natural language conversation is transformed into machine-usable search input. This conversion is one of the major differences between AI search and traditional search. The user’s natural language question is first turned into a query the system considers more suitable for search, before entering the source retrieval process. AI SEO analysis therefore cannot stop at the user’s original sentence.

Why AI search may not equal the user’s original sentence

AI search may not equal the user’s original sentence because the system may first transform a natural question into a query that is better suited for search. Users may ask questions in a conversational, vague, or context-dependent way. Search queries usually need to be shorter, clearer, and easier to retrieve against.

This transformation creates a gap between AI SEO and traditional keyword research. Traditional workflows often treat the user’s typed words as the primary optimization target. AI search, however, may rewrite the same question into a broader topic query, comparison query, or definition query.

The point is not that exact keywords no longer matter. A more accurate view is that exact keywords explain only part of search visibility. If the AI actually searches a broader or more conceptual query, whether the page can be found depends on whether it is understood as a candidate source for that topic.

Query generation therefore means Discovery is no longer identical to ranking for one keyword. A page may perform well for a manual search query, but never enter the candidate set for an AI-generated query.

How query generation affects the four-stage AI citation funnel

Query generation mainly affects Discovery, but it also indirectly affects Relevance and Citation. If the generated query does not find your page, even a strong content passage has no chance to enter later comparison.

StageImpact of query generationMeaning for content diagnosis
Web ActivationQuery generation usually happens after an external source path is activated. If there is no external search or source retrieval, this step does not matter.First confirm whether the answer used an external source path.
DiscoveryThe query generated by the system affects which pages enter the candidate source set.If the page does not appear, the issue may be query coverage, not only content quality.
RelevanceThe query also affects how later content passages are compared.The same passage may be judged more or less relevant depending on the query.
CitationIf the query finds other sources that are more direct or more credible, the final answer may cite them instead.Citation failure can sometimes begin at the query generation stage.

The point of this table is not to treat query generation as the whole problem. It is to place it inside the four-stage funnel. Query generation is not the final Citation decision, but it decides which pages are eligible to enter the later comparison.

If a page ranks well in traditional search but is rarely cited by AI search, one of the first questions to examine is whether the queries an AI may generate can actually find that page. This is closer to the AI search flow than tracking only one manually entered keyword.

How query generation changes Discovery diagnosis

Discovery is not simply a question of whether the page ranks. In AI search, the more precise question is: did the search query generated by the AI bring the page into the candidate source set?

This difference changes diagnosis. If the page is not seen by AI search, the problem may not be that the article is poor. It may be that the generated query and the page topic do not align. A page may rank for a manual keyword, but lack visibility for the broader query generated by the AI.

Query generation also creates multiple candidate paths for the same topic. The system may use a definition query, comparison query, question query, or freshness-oriented query. Different queries produce different candidate sources, so different pages enter the later flow.

Discovery diagnosis therefore cannot only look at one keyword position. A more accurate analysis compares multiple possible AI-generated queries and observes whether the page consistently enters the candidate source set. This analysis is still not Citation, but it shows whether the page passes the front entrance of AI search.

Conclusion: AI SEO should analyze query intent, not only keywords

AI SEO keyword research should not stop at what users type. OpenWebUI’s default query generation prompt shows that in an observable RAG flow, the system may first analyze chat history, generate 1–3 broad and relevant search queries, and use those queries to retrieve candidate sources.

This means AI SEO analysis should look at query intent, not only query wording. Exact keywords still matter, but they are only one part of AI search visibility. What truly affects Discovery is whether the system-generated query can bring your page into the candidate source set.

The next article will move into search results and page extraction. After AI generates a query and retrieves candidate sources, the system usually sees links, titles, and snippets before it sees the full page. This affects how AI search decides whether your page is worth processing further.

References

Frequently asked questions

Does AI search directly search the user’s original sentence?

Not necessarily. In OpenWebUI’s default query generation prompt, the system first analyzes the chat history and prioritizes generating 1–3 broad and relevant search queries. These queries may differ from the user’s original wording.

How does query generation affect AI SEO?

Query generation affects Discovery, meaning whether a page enters the candidate source set. If the query generated by the AI does not find your page, later content processing, relevance comparison, and citation selection will not happen.

Why is OpenWebUI’s query generation prompt worth analyzing?

It provides an observable open-source sample showing how AI web search may convert chat context into search queries. This does not mean every AI platform works the same way, but it helps explain early-stage AI SEO visibility.

Read next

How OpenWebUI helps us understand AI SEO: from query generation to citation

Continue reading