Let data sources be searched page by page with a query of their own

This commit is contained in:
Thorsten Sommer committed 2026-09-24 15:25:14 +02:00
1 parent 4617aa5230
commit 92339479d0
9 files changed
+449 -68

No files matched your search

+19 -2
View File
@@ -22,10 +22,10 @@ public interface IDataSource : IConfigurationObject
public DataSourceType Type { get; init; }
/// <summary>
/// The maximum number of matches to return when retrieving data from the ERI server.
/// The maximum number of matches one retrieval returns. Searched page by page, it is the size of a page.
/// </summary>
public ushort MaxMatches { get; init; }
/// <summary>
/// Perform the data retrieval process.
/// </summary>
@@ -34,4 +34,21 @@ public interface IDataSource : IConfigurationObject
/// <param name="token">The cancellation token.</param>
/// <returns>The retrieved data context.</returns>
public Task<IReadOnlyList<IRetrievalContext>> RetrieveDataAsync(IContent lastUserPrompt, ChatThread thread, CancellationToken token = default);
/// <summary>
/// Search the data source for a query of its own, one page at a time.
/// </summary>
/// <remarks>
/// Unlike the retrieval above, the query need not be what the user wrote last: Semantic Search
/// lets the model work it out from the conversation, and search as often as it takes. The first
/// page holds what the retrieval above finds for the same text. How the pages are cut is
/// described in RetrievalPaging.
/// </remarks>
/// <param name="query">What to search for.</param>
/// <param name="page">The page to retrieve, from 1 up to RetrievalPaging.GetLastPage for MaxMatches.</param>
/// <param name="thread">The chat thread.</param>
/// <param name="token">The cancellation token.</param>
/// <returns>The retrieved data contexts of this page, and whether the next page is worth asking for.</returns>
/// <exception cref="ArgumentOutOfRangeException">The page is below 1 or beyond the last page.</exception>
public Task<RetrievalPage> RetrieveDataAsync(string query, int page, ChatThread thread, CancellationToken token = default);
}