namespace AIStudio.Assistants.BeyondFactsLab;
///
/// How much of a material a request of a step carries.
///
/// The material.
/// How many characters of its text, from the beginning, the prompt carries at most; 0 for an image.
/// Whether an image reaches the model; NONE for any other kind of material.
public sealed record BflMaterialShare(BflMaterial Material, int Characters, BflImageDelivery Image = BflImageDelivery.NONE)
{
///
/// Gets whether the prompt carries the whole text.
///
public bool IsComplete => this.Characters >= this.Material.TextLength;
///
/// Gets which share of the text the prompt carries, in percent: 100 for the whole text, 0 for none of it, and
/// between 1 and 99 for a part of it, however small or large.
///
public int Percent
{
get
{
if (this.IsComplete)
return 100;
if (this.Characters <= 0)
return 0;
return (int)Math.Clamp(100L * this.Characters / this.Material.TextLength, 1, 99);
}
}
}