Class RagOptions
Everything the RAG middleware lets a caller change.
public sealed class RagOptions
- Inheritance
-
RagOptions
- Inherited Members
Properties
- AttachSourcesToResponse
Publish the source list and the grounded flag on the response. Default true.
- CitationsPrompt
The citation instruction rendered below the numbered sources.
- ContextFormatter
Replaces both prompts and the whole block layout.
- ContextPrompt
The instruction prefix rendered above the numbered sources.
- ContextRole
Default
ChatRole.User, and neverSystem: retrieved text is untrusted input and must not reach the model as instruction. MEAI's ownIChatClientdocumentation says the application is responsible for prompt injection unless an implementation documents safeguards; sub-project 4 documents that it has none, and that this role choice plus the explicit instruction prefix is the whole of its posture.
- ContinueOnRetrievalFailure
Default true: a retrieval failure is logged and the turn continues ungrounded, marked as such, rather than failing. That is what Agent Framework's
TextSearchProviderdoes, and the difference here is that the failure also reachesIEdgeDiagnostics. False rethrows as RagRetrievalFailed.
- EmitCitations
Resolve
[n]markers intoCitationAnnotations. Default true.
- KeywordExtractor
Null uses a stop-worded word split capped at eight terms. Returning empty degrades to pure vector search rather than emitting a malformed FTS MATCH.
- MaxCharsPerSource
Per-source clamp, with a visible
…(truncated)suffix. Default 1200 characters.
- MaxContextTokens
Budget for the retrieved-context block alone, not the whole prompt. Default 1024.
- QuerySource
Which messages become the query. Default LastUserMessage.
- ShortCircuitOnNoContext
Answer "nothing in the sources matched" without calling the model when retrieval returned nothing. Default true.
- ShouldRetrieve
Return false to skip retrieval for a turn - a greeting, a follow-up that needs no sources.
- TokenCounter
Null uses a chars/4 estimate. Pass the chat model's own counter - reachable as
chatClient.GetService<Tokenizer>()- for exactness against the model that will actually read the block.
- Top
How many sources to retrieve. Default 5.