namespace AIStudio.Tools.RAG; /// /// What kept one retrieval from covering the whole data source. /// /// Whether the query is the user's own message, which decides who hears about its problems. public sealed class RetrievalRun(bool queryWrittenByUser) { // Both channels search at the same time: private readonly Lock gapLock = new(); private readonly HashSet gaps = []; public bool QueryWrittenByUser => queryWrittenByUser; public void Add(RetrievalGap gap) { lock (this.gapLock) this.gaps.Add(gap); } public IReadOnlyList GetGaps() { lock (this.gapLock) return this.gaps.Order().ToList(); } }