Expand description
Numbered citation markers ([1], [2], …) for RAG-retrieved knowledge
chunks, threaded through the existing normalized SSE event model
(crate::uar::domain::events::NormalizedEvent::RagCitations).
CitationStream is the single reusable seam between “we retrieved some
chunks” and “the client can render [1]/[2] markers with a
hover-to-source panel”: it assigns stable 1-based marker numbers to
retrieved chunks, renders the numbered block that gets injected into the
system prompt (so the model has a reason to emit [1], [2] in its
answer), and converts to the wire event that carries those markers to the
client.
This type intentionally carries no transport or UI concerns — it is built
from retrieval results (KnowledgeMatch or RAGContext) and produces
plain, serializable data (RagCitation). That keeps it reusable by
future consumers beyond the chat SSE stream (e.g. the A2UI surfaces in
later grade-A changes, or an eval harness that wants a run’s citation set
without going through SSE at all).
Structs§
- Citation
Stream - Ordered, numbered set of citation markers for a single RAG-augmented run.