Added an option to enable or disable the context validation

This commit is contained in:
Thorsten Sommer 2025-02-18 16:06:36 +01:00
parent ea96f08c57
commit 129e0d0779
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 18 additions and 9 deletions

View File

@ -1,13 +1,17 @@
@inherits SettingsPanelBase @inherits SettingsPanelBase
<ExpansionPanel HeaderIcon="@Icons.Material.Filled.Assessment" HeaderText="Agent: Retrieval Context Validation Options"> <ExpansionPanel HeaderIcon="@Icons.Material.Filled.Assessment" HeaderText="Agent: Retrieval Context Validation Options">
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
<MudText Typo="Typo.body1" Class="mb-3"> <MudText Typo="Typo.body1" Class="mb-3">
Use Case: this agent is used to validate any retrieval context of the retrieval process. Perhaps there are many of these Use Case: this agent is used to validate any retrieval context of any retrieval process. Perhaps there are many of these
retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this retrieval contexts and you want to validate them all. Therefore, you might want to use a cheap and fast LLM for this
job. When using a local or self-hosted LLM, look for a small (e.g. 3B) and fast model. job. When using a local or self-hosted LLM, look for a small (e.g. 3B) and fast model.
</MudText> </MudText>
<ConfigurationOption OptionDescription="Enable the retrieval context validation agent?" LabelOn="The validation agent is enabled" LabelOff="No validation is performed" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation = updatedState)" OptionHelp="When enabled, the retrieval context validation agent will check each retrieval context of any retrieval process, whether a context makes sense for the given prompt."/>
@if (this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.EnableRetrievalContextValidation)
{
<MudPaper Class="pa-3 mb-8 border-dashed border rounded-lg">
<ConfigurationOption OptionDescription="Preselect retrieval context validation options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer a LLM."/> <ConfigurationOption OptionDescription="Preselect retrieval context validation options?" LabelOn="Options are preselected" LabelOff="No options are preselected" State="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" StateUpdate="@(updatedState => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions = updatedState)" OptionHelp="When enabled, you can preselect some agent options. This is might be useful when you prefer a LLM."/>
<ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider = selectedValue)"/> <ConfigurationProviderSelection Data="@this.AvailableLLMProvidersFunc()" Disabled="@(() => !this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectAgentOptions)" SelectedValue="@(() => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider)" SelectionUpdate="@(selectedValue => this.SettingsManager.ConfigurationData.AgentRetrievalContextValidation.PreselectedAgentProvider = selectedValue)"/>
</MudPaper> </MudPaper>
}
</ExpansionPanel> </ExpansionPanel>

View File

@ -2,6 +2,11 @@ namespace AIStudio.Settings.DataModel;
public sealed class DataAgentRetrievalContextValidation public sealed class DataAgentRetrievalContextValidation
{ {
/// <summary>
/// Enable the retrieval context validation agent?
/// </summary>
public bool EnableRetrievalContextValidation { get; set; }
/// <summary> /// <summary>
/// Preselect any retrieval context validation options? /// Preselect any retrieval context validation options?
/// </summary> /// </summary>