mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 07:17:59 +00:00
Implemented the retrieval process configuration
This commit is contained in:
7 files changed
+553
No files matched your search
@@ -201,6 +201,44 @@
|
||||
Data retrieval settings
|
||||
</MudText>
|
||||
|
||||
<MudText Typo="Typo.body1" Class="mb-2">
|
||||
For your ERI server, you need to retrieve data that matches a chat or prompt in some way. We call this the retrieval process.
|
||||
You must describe at least one such process. You may offer several retrieval processes from which users can choose. This allows
|
||||
you to test with beta users which process works better. Or you might generally want to give users the choice so they can select
|
||||
the process that best suits their circumstances.
|
||||
</MudText>
|
||||
|
||||
<MudTable Items="@this.retrievalProcesses" Hover="@true" Class="border-dashed border rounded-lg">
|
||||
<ColGroup>
|
||||
<col/>
|
||||
<col style="width: 34em;"/>
|
||||
</ColGroup>
|
||||
<HeaderContent>
|
||||
<MudTh>Name</MudTh>
|
||||
<MudTh Style="text-align: left;">Actions</MudTh>
|
||||
</HeaderContent>
|
||||
<RowTemplate>
|
||||
<MudTd>@context.Name</MudTd>
|
||||
<MudTd Style="text-align: left;">
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Edit" Class="ma-2" OnClick="() => this.EditRetrievalProcess(context)">
|
||||
Edit
|
||||
</MudButton>
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Error" StartIcon="@Icons.Material.Filled.Delete" Class="ma-2" OnClick="() => this.DeleteRetrievalProcess(context)">
|
||||
Delete
|
||||
</MudButton>
|
||||
</MudTd>
|
||||
</RowTemplate>
|
||||
</MudTable>
|
||||
|
||||
@if(this.retrievalProcesses.Count == 0)
|
||||
{
|
||||
<MudText Typo="Typo.h6" Class="mt-3">No retrieval process configured yet.</MudText>
|
||||
}
|
||||
|
||||
<MudButton Variant="Variant.Filled" Color="@Color.Primary" StartIcon="@Icons.Material.Filled.AddRoad" Class="mt-3 mb-6" OnClick="@this.AddRetrievalProcess">
|
||||
Add Retrieval Process
|
||||
</MudButton>
|
||||
|
||||
<MudText Typo="Typo.body1" Class="mb-1">
|
||||
You can integrate additional libraries. Perhaps you want to evaluate the prompts in advance using a machine learning method or analyze them with a text
|
||||
mining approach? Or maybe you want to preprocess images in the prompts? For such advanced scenarios, you can specify which libraries you want to use here.
|
||||
|
||||
@@ -64,6 +64,7 @@ public partial class AssistantERI : AssistantBaseCore
|
||||
this.selectedOperatingSystem = OperatingSystem.NONE;
|
||||
this.allowedLLMProviders = AllowedLLMProviders.NONE;
|
||||
this.embeddings = new();
|
||||
this.retrievalProcesses = new();
|
||||
this.additionalLibraries = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -92,6 +93,7 @@ public partial class AssistantERI : AssistantBaseCore
|
||||
this.selectedOperatingSystem = this.SettingsManager.ConfigurationData.ERI.PreselectedOperatingSystem;
|
||||
this.allowedLLMProviders = this.SettingsManager.ConfigurationData.ERI.PreselectedAllowedLLMProviders;
|
||||
this.embeddings = this.SettingsManager.ConfigurationData.ERI.PreselectedEmbeddingInfos;
|
||||
this.retrievalProcesses = this.SettingsManager.ConfigurationData.ERI.PreselectedRetrievalInfos;
|
||||
this.additionalLibraries = this.SettingsManager.ConfigurationData.ERI.PreselectedAdditionalLibraries;
|
||||
return true;
|
||||
}
|
||||
@@ -125,6 +127,7 @@ public partial class AssistantERI : AssistantBaseCore
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedOperatingSystem = this.selectedOperatingSystem;
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedAllowedLLMProviders = this.allowedLLMProviders;
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedEmbeddingInfos = this.embeddings;
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedRetrievalInfos = this.retrievalProcesses;
|
||||
this.SettingsManager.ConfigurationData.ERI.PreselectedAdditionalLibraries = this.additionalLibraries;
|
||||
await this.SettingsManager.StoreSettings();
|
||||
}
|
||||
@@ -146,6 +149,7 @@ public partial class AssistantERI : AssistantBaseCore
|
||||
private OperatingSystem selectedOperatingSystem = OperatingSystem.NONE;
|
||||
private AllowedLLMProviders allowedLLMProviders = AllowedLLMProviders.NONE;
|
||||
private List<EmbeddingInfo> embeddings = new();
|
||||
private List<RetrievalInfo> retrievalProcesses = new();
|
||||
private string additionalLibraries = string.Empty;
|
||||
|
||||
private string? ValidateServerName(string name)
|
||||
@@ -460,6 +464,65 @@ public partial class AssistantERI : AssistantBaseCore
|
||||
this.embeddings.Remove(embeddingInfo);
|
||||
await this.AutoSave();
|
||||
}
|
||||
|
||||
private async Task AddRetrievalProcess()
|
||||
{
|
||||
var dialogParameters = new DialogParameters<RetrievalProcessDialog>
|
||||
{
|
||||
{ x => x.IsEditing, false },
|
||||
{ x => x.AvailableEmbeddings, this.embeddings },
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<RetrievalProcessDialog>("Add Retrieval Process", dialogParameters, DialogOptions.FULLSCREEN);
|
||||
var dialogResult = await dialogReference.Result;
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
return;
|
||||
|
||||
var addedRetrievalProcess = (RetrievalInfo)dialogResult.Data!;
|
||||
this.retrievalProcesses.Add(addedRetrievalProcess);
|
||||
await this.AutoSave();
|
||||
}
|
||||
|
||||
private async Task EditRetrievalProcess(RetrievalInfo retrievalInfo)
|
||||
{
|
||||
var dialogParameters = new DialogParameters<RetrievalProcessDialog>
|
||||
{
|
||||
{ x => x.DataName, retrievalInfo.Name },
|
||||
{ x => x.DataDescription, retrievalInfo.Description },
|
||||
{ x => x.DataLink, retrievalInfo.Link },
|
||||
{ x => x.DataParametersDescription, retrievalInfo.ParametersDescription },
|
||||
{ x => x.DataEmbeddings, retrievalInfo.Embeddings?.ToHashSet() },
|
||||
|
||||
{ x => x.IsEditing, true },
|
||||
{ x => x.AvailableEmbeddings, this.embeddings },
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<EmbeddingMethodDialog>("Edit Retrieval Process", dialogParameters, DialogOptions.FULLSCREEN);
|
||||
var dialogResult = await dialogReference.Result;
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
return;
|
||||
|
||||
var editedRetrievalProcess = (RetrievalInfo)dialogResult.Data!;
|
||||
|
||||
this.retrievalProcesses[this.retrievalProcesses.IndexOf(retrievalInfo)] = editedRetrievalProcess;
|
||||
await this.AutoSave();
|
||||
}
|
||||
|
||||
private async Task DeleteRetrievalProcess(RetrievalInfo retrievalInfo)
|
||||
{
|
||||
var dialogParameters = new DialogParameters
|
||||
{
|
||||
{ "Message", $"Are you sure you want to delete the retrieval process '{retrievalInfo.Name}'?" },
|
||||
};
|
||||
|
||||
var dialogReference = await this.DialogService.ShowAsync<ConfirmDialog>("Delete Retrieval Process", dialogParameters, DialogOptions.FULLSCREEN);
|
||||
var dialogResult = await dialogReference.Result;
|
||||
if (dialogResult is null || dialogResult.Canceled)
|
||||
return;
|
||||
|
||||
this.retrievalProcesses.Remove(retrievalInfo);
|
||||
await this.AutoSave();
|
||||
}
|
||||
|
||||
private async Task GenerateServer()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace AIStudio.Assistants.ERI;
|
||||
|
||||
/// <summary>
|
||||
/// Information about a retrieval process, which this data source implements.
|
||||
/// </summary>
|
||||
/// <param name="Name">The name of the retrieval process, e.g., "Keyword-Based Wikipedia Article Retrieval".</param>
|
||||
/// <param name="Description">A short description of the retrieval process. What kind of retrieval process is it?</param>
|
||||
/// <param name="Link">A link to the retrieval process's documentation, paper, Wikipedia article, or the source code. Might be null.</param>
|
||||
/// <param name="ParametersDescription">A dictionary that describes the parameters of the retrieval process. The key is the parameter name,
|
||||
/// and the value is a description of the parameter. Although each parameter will be sent as a string, the description should indicate the
|
||||
/// expected type and range, e.g., 0.0 to 1.0 for a float parameter.</param>
|
||||
/// <param name="Embeddings">A list of embeddings used in this retrieval process. It might be empty in case no embedding is used.</param>
|
||||
public readonly record struct RetrievalInfo(
|
||||
string Name,
|
||||
string Description,
|
||||
string? Link,
|
||||
Dictionary<string, string>? ParametersDescription,
|
||||
List<EmbeddingInfo>? Embeddings);
|
||||
@@ -0,0 +1,14 @@
|
||||
namespace AIStudio.Assistants.ERI;
|
||||
|
||||
public sealed class RetrievalParameter
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the parameter.
|
||||
/// </summary>
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The description of the parameter.
|
||||
/// </summary>
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
Reference in new issue
Block a user