2026-09-04 15:48:07 +02:00
|
|
|
using AIStudio.Provider;
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Tools.Web;
|
|
|
|
|
|
2026-09-23 22:21:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// A web page or text document as the retrieval service read it.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Nothing here is filtered for prompt injections yet. Everything a caller hands on to a model
|
|
|
|
|
/// has to go through the WebPageContentSanitizer or the PromptInjectionGuardService first, after
|
|
|
|
|
/// it was cut down to what the model actually gets: only that part needs checking, and a page
|
|
|
|
|
/// can be far larger.
|
|
|
|
|
/// </remarks>
|
2026-09-04 15:48:07 +02:00
|
|
|
public sealed class RetrievedWebPage
|
|
|
|
|
{
|
|
|
|
|
public required HTMLParserWebPage Page { get; init; }
|
|
|
|
|
|
2026-09-23 22:21:09 +02:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the content was extracted from an HTML page or is the text of a document.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public required WebContentKind ContentKind { get; init; }
|
|
|
|
|
|
2026-09-04 15:48:07 +02:00
|
|
|
public required ExtractedWebPage ExtractedPage { get; init; }
|
|
|
|
|
|
|
|
|
|
public required DateTimeOffset RetrievedAtUtc { get; init; }
|
|
|
|
|
|
|
|
|
|
public ConfidenceLevel RequiredProviderConfidence { get; init; } = ConfidenceLevel.NONE;
|
2026-10-18 19:39:55 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the page was read from a non-public address, such as one in the intranet or behind
|
|
|
|
|
/// a VPN.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Only the request which returned the page counts, the last one after every redirect: it is
|
|
|
|
|
/// where the content came from. A public address which redirects into the intranet therefore
|
|
|
|
|
/// counts, and an intranet address which redirects to a public page, such as a sign-in page,
|
|
|
|
|
/// does not.<br/><br/>
|
|
|
|
|
/// The content of such a page is internal, so a caller which hands it to a model has to keep
|
|
|
|
|
/// it from leaving the organization. Stated here rather than read from
|
|
|
|
|
/// RequiredProviderConfidence, which answers another question: it counts every request, so the
|
|
|
|
|
/// address of an intranet page does not reach a less trusted provider either.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
public bool ReachedNonPublicAddress { get; init; }
|
2026-09-04 15:48:07 +02:00
|
|
|
}
|