namespace AIStudio.Settings.DataModel;
public sealed class DataSourceOptions
{
///
/// Whether data sources are disabled in this context.
///
public bool DisableDataSources { get; set; } = true;
///
/// Whether the data sources should be selected automatically.
///
///
/// When true, the appropriate data sources for the current prompt are
/// selected automatically. When false, the user has to select the
/// data sources manually.
///
/// This setting does not affect the selection of the actual data
/// for augmentation.
///
public bool AutomaticDataSourceSelection { get; set; }
///
/// Whether the retrieved data should be validated for the current prompt.
///
///
/// When true, the retrieved data is validated against the current prompt.
/// An AI will decide whether the data point is useful for answering the
/// prompt or not.
///
public bool AutomaticValidation { get; set; }
///
/// The preselected data source IDs. When these data sources are available
/// for the selected provider, they are pre-selected.
///
public List PreselectedDataSourceIds { get; set; } = [];
///
/// Returns true when data sources are enabled.
///
/// True when data sources are enabled.
public bool IsEnabled()
{
if(this.DisableDataSources)
return false;
if(this.AutomaticDataSourceSelection)
return true;
return this.PreselectedDataSourceIds.Count > 0;
}
///
/// Creates a copy of the current data source options.
///
/// A copy of the current data source options.
public DataSourceOptions CreateCopy() => new()
{
DisableDataSources = this.DisableDataSources,
AutomaticDataSourceSelection = this.AutomaticDataSourceSelection,
AutomaticValidation = this.AutomaticValidation,
PreselectedDataSourceIds = [..this.PreselectedDataSourceIds],
};
}