AI-Studio/app/MindWork AI Studio/Tools/RAG/RetrievalTextContext.cs
Thorsten Sommer 1ebe8eb2a4
Some checks are pending
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Let the sources of your own documents open at the page they were found on (#974)
2026-09-15 19:11:39 +02:00

63 lines
2.0 KiB
C#

namespace AIStudio.Tools.RAG;
/// <summary>
/// The retrieval context for text data.
/// </summary>
public sealed class RetrievalTextContext : IRetrievalContext
{
#region Implementation of IRetrievalContext
/// <inheritdoc />
public required string DataSourceName { get; init; }
/// <inheritdoc />
public required RetrievalContentCategory Category { get; init; }
/// <inheritdoc />
public required RetrievalContentType Type { get; init; }
/// <inheritdoc />
public required string Path { get; init; }
/// <inheritdoc />
public IReadOnlyList<string> Links { get; init; } = [];
#endregion
/// <summary>
/// The text content.
/// </summary>
/// <remarks>
/// Should contain the matched text and some small context around it.
/// </remarks>
public required string MatchedText { get; set; }
/// <summary>
/// The surrounding content of the matched text.
/// </summary>
/// <remarks>
/// Might give the user some context about the matched text.
/// For example, one sentence or paragraph before and after the matched text.
/// </remarks>
public IReadOnlyList<string> SurroundingContent { get; set; } = [];
/// <summary>
/// Optional title used when this context is displayed as a source reference.
/// </summary>
public string ReferenceTitle { get; init; } = string.Empty;
/// <summary>
/// Optional link used when this context is displayed as a source reference.
/// </summary>
public string ReferenceLink { get; init; } = string.Empty;
/// <summary>
/// The page this passage was found on, or null when it has none.
/// </summary>
/// <remarks>
/// Kept as a number rather than only inside the reference title: the AI is told the page so it
/// can say where an answer comes from, and a source has to name a page a program can be sent
/// to. A slide or a sheet has no page and leaves this empty.
/// </remarks>
public int? PageNumber { get; init; }
}