Class RagChatClient
Retrieve, assemble, stream, cite. Ordinary MEAI middleware.
public sealed class RagChatClient : DelegatingChatClient, IChatClient, IDisposable
- Inheritance
-
RagChatClient
- Implements
- Inherited Members
Remarks
It is DelegatingChatClient middleware and not a facade: it references no
ONNX package, no Qavren.Edge.Chat.Onnx and no Qavren.Edge.VectorData, which is what
lets UseRag() sit over an Azure OpenAI client, an ExtractiveChatClient, or
anything else that is an IChatClient.
It does not type-test its inner client and has no special case for ExtractiveChatClient. The structured sources travel inward over SourcesPropertyKey, a documented public key, which is what keeps the no-LLM floor reproducible outside this package.
Constructors
- RagChatClient(IChatClient, IEdgeRetriever, RagOptions?, ILoggerFactory?)
Creates the middleware over an inner client and a retriever.
Properties
- Options
The options this pipeline was built with.
- Retriever
The retriever this pipeline asks.
Methods
- GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions?, CancellationToken)
GetStreamingResponseAsync(...).ToChatResponseAsync(ct), plus exactly one fix-up: the citation list is moved from the streaming carrier - an emptyTextContenton the final update - onto the aggregated assistant message's firstTextContent, whoseTextis the same concatenation the spans already index, and the emptied carrier is dropped. The offsets are not recomputed, because the string does not change. The fix-up exists because MEAI's aggregation may coalesce adjacentTextContents, so the content holding the full text is the only one whose identity survives it.
- GetService(Type, object?)
Returns
this, IEdgeRetriever and RagOptions, then delegates inward - soGetService<ChatClientMetadata>()still reaches the leaf through the stack, which is what keeps Semantic Kernel and Agent Framework working over a RAG pipeline.
- GetStreamingResponseAsync(IEnumerable<ChatMessage>, ChatOptions?, CancellationToken)
Sends chat messages and streams the response.