Property QueryGenerationMode
QueryGenerationMode
Gets or sets the mode used to generate retrieval queries from user input.
public QueryGenerationMode QueryGenerationMode { get; set; }
Property Value
- QueryGenerationMode
The query generation mode. Default is Original.
Examples
using var chat = new PdfChat(chatModel, embeddingModel);
// Enable contextual query rewriting for multi-turn conversations
chat.QueryGenerationMode = QueryGenerationMode.Contextual;
Remarks
When set to Original, the user's question is used as-is for retrieval, matching the behavior of single-turn queries.
When set to Contextual, follow-up questions are automatically reformulated into self-contained queries using the conversation history before passage retrieval. This improves retrieval accuracy for multi-turn conversations where questions contain references to previous exchanges (e.g., pronouns, ellipsis, or implicit topics).
On the first turn of a conversation (no prior history), the original question is always used regardless of this setting.
- See Also