Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add embedding configurations #224

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9f59243
Updated internal embedding task
SommerEngineering Nov 24, 2024
013b9cb
Spelling
SommerEngineering Dec 1, 2024
b76590a
Add experimental preview feature option
SommerEngineering Dec 1, 2024
340f0ef
Add components to mark & explain preview features
SommerEngineering Dec 1, 2024
c9ce1ac
Added method to get embedding models of a certain provider
SommerEngineering Dec 1, 2024
a0c7875
Spelling
SommerEngineering Dec 1, 2024
4e7d19d
Refactored LLM provider related actions
SommerEngineering Dec 1, 2024
f47c4da
Removed unnecessary setter
SommerEngineering Dec 2, 2024
311ad20
Spelling
SommerEngineering Dec 2, 2024
dc1f9ef
Refactored secret handling
SommerEngineering Dec 2, 2024
d65e9c5
Refactored secret handling
SommerEngineering Dec 2, 2024
e0b69ee
Refactored provider validation
SommerEngineering Dec 2, 2024
cc6d7ca
Refactored the host extensions into its own file
SommerEngineering Dec 3, 2024
c282c20
Changed state
SommerEngineering Dec 3, 2024
4a9c2e3
Refactored provider dashboard metadata into provider extensions
SommerEngineering Dec 3, 2024
762d68f
Added embedding metadata to hosts
SommerEngineering Dec 3, 2024
bc67669
Removed not used logger
SommerEngineering Dec 3, 2024
1260044
Renamed provider-related symbols to clarify their LLM context
SommerEngineering Dec 3, 2024
66232da
Implemented embedding provider configuration
SommerEngineering Dec 3, 2024
eae33e5
Exclude embedding models for self-hosted providers
SommerEngineering Dec 3, 2024
492cf4a
Improved LM Studio handling by querying embedding models
SommerEngineering Dec 3, 2024
8380cf0
Updated changelog
SommerEngineering Dec 3, 2024
81d2f3f
Updated RAG tasks
SommerEngineering Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Things we are currently working on:
- [x] ~~Define the [External Data API (EDI)](https://github.com/MindWorkAI/EDI) as a contract for integrating arbitrary external data (PR [#1](https://github.com/MindWorkAI/EDI/pull/1))~~
- [x] ~~App: Metadata for providers (which provider offers embeddings?) (PR [#205](https://github.com/MindWorkAI/AI-Studio/pull/205))~~
- [x] ~~App: Add an option to show preview features (PR [#222](https://github.com/MindWorkAI/AI-Studio/pull/222))~~
- [ ] App: Configure embedding providers
- [ ] ~~App: Configure embedding providers (PR [#224](https://github.com/MindWorkAI/AI-Studio/pull/224))~~
- [ ] App: Management of data sources (local & external data via [EDI](https://github.com/MindWorkAI/EDI))
- [ ] Runtime: Extract data from txt / md / pdf / docx / xlsx files
- [ ] Runtime: Implement internal embedding provider through [fastembed-rs](https://github.com/Anush008/fastembed-rs)
- [ ] (*Optional*) Runtime: Implement internal embedding provider through [fastembed-rs](https://github.com/Anush008/fastembed-rs)
- [ ] App: Implement external embedding providers
- [ ] App: Implement the process to vectorize one local file using embeddings
- [ ] Runtime: Integration of the vector database [LanceDB](https://github.com/lancedb/lancedb)
Expand Down
20 changes: 20 additions & 0 deletions app/MindWork AI Studio/Components/PreviewAlpha.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.FirstPage" Color="Color.Error" Class="mb-3">
Alpha
</MudChip>
</ChildContent>
<TooltipContent>
<div style="max-width: 22em;">
<MudText Typo="Typo.body2" Class="mb-3">
This feature is currently in the alpha phase.
Expect bugs and unfinished work.
</MudText>

<MudText Typo="Typo.body2">
Alpha phase means that we are working on the
last details before the beta phase.
</MudText>
</div>
</TooltipContent>
</MudTooltip>
5 changes: 5 additions & 0 deletions app/MindWork AI Studio/Components/PreviewAlpha.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class PreviewAlpha : ComponentBase;
19 changes: 19 additions & 0 deletions app/MindWork AI Studio/Components/PreviewBeta.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.HourglassTop" Color="Color.Info" Class="mb-3">
Beta
</MudChip>
</ChildContent>
<TooltipContent>
<div style="max-width: 20em;">
<MudText Typo="Typo.body2" Class="mb-3">
This feature is currently in the beta phase.
It is still be possible that there are some bugs.
</MudText>

<MudText Typo="Typo.body2">
Beta phase means that we are testing the feature.
</MudText>
</div>
</TooltipContent>
</MudTooltip>
5 changes: 5 additions & 0 deletions app/MindWork AI Studio/Components/PreviewBeta.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class PreviewBeta : ComponentBase;
22 changes: 22 additions & 0 deletions app/MindWork AI Studio/Components/PreviewExperimental.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.Science" Color="Color.Error" Class="mb-3">
Experimental
</MudChip>
</ChildContent>
<TooltipContent>
<div style="max-width: 26em;">
<MudText Typo="Typo.body2" Class="mb-3">
This feature is currently in the experimental phase.
Expect bugs, unfinished work, changes in future
versions, and more.
</MudText>

<MudText Typo="Typo.body2">
Experimental phase means that we have a vision for a feature
but not a clear plan yet. We are still exploring the
possibilities.
</MudText>
</div>
</TooltipContent>
</MudTooltip>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class PreviewExperimental : ComponentBase;
21 changes: 21 additions & 0 deletions app/MindWork AI Studio/Components/PreviewPrototype.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.HourglassBottom" Color="Color.Error" Class="mb-3">
Prototype
</MudChip>
</ChildContent>
<TooltipContent>
<div style="max-width: 22em;">
<MudText Typo="Typo.body2" Class="mb-3">
This feature is currently in the prototype phase.
Expect bugs, unfinished work, changes in future
versions, and more.
</MudText>

<MudText Typo="Typo.body2">
Prototype phase means that we have a plan but we
are still working on it.
</MudText>
</div>
</TooltipContent>
</MudTooltip>
5 changes: 5 additions & 0 deletions app/MindWork AI Studio/Components/PreviewPrototype.razor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class PreviewPrototype : ComponentBase;
19 changes: 19 additions & 0 deletions app/MindWork AI Studio/Components/PreviewReleaseCandidate.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<MudTooltip Placement="Placement.Bottom" Arrow="@true">
<ChildContent>
<MudChip T="string" Icon="@Icons.Material.Filled.VerifiedUser" Color="Color.Success" Class="mb-3">
Release Candidate
</MudChip>
</ChildContent>
<TooltipContent>
<div style="max-width: 20em;">
<MudText Typo="Typo.body2" Class="mb-3">
This feature is about to be released. We think it's ready for production.
There should be no more bugs.
</MudText>

<MudText Typo="Typo.body2">
Release candidates are the final step before a feature is proven to be stable.
</MudText>
</div>
</TooltipContent>
</MudTooltip>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Microsoft.AspNetCore.Components;

namespace AIStudio.Components;

public partial class PreviewReleaseCandidate : ComponentBase;
118 changes: 118 additions & 0 deletions app/MindWork AI Studio/Dialogs/EmbeddingDialog.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
@using AIStudio.Provider
@using AIStudio.Provider.SelfHosted

<MudDialog>
<DialogContent>
<MudForm @ref="@this.form" @bind-IsValid="@this.dataIsValid" @bind-Errors="@this.dataIssues">
<MudStack Row="@true" AlignItems="AlignItems.Center">
@* ReSharper disable once CSharpWarnings::CS8974 *@
<MudSelect @bind-Value="@this.DataLLMProvider" Label="Provider" Class="mb-3" OpenIcon="@Icons.Material.Filled.AccountBalance" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingProvider">
@foreach (LLMProviders provider in Enum.GetValues(typeof(LLMProviders)))
{
if (provider.ProvideEmbeddings())
{
<MudSelectItem Value="@provider">@provider</MudSelectItem>
}
}
</MudSelect>
<MudButton Disabled="@(!this.DataLLMProvider.ShowRegisterButton())" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.OpenInBrowser" Href="@this.DataLLMProvider.GetCreationURL()" Target="_blank">Create account</MudButton>
</MudStack>

@* ReSharper disable once CSharpWarnings::CS8974 *@
<MudTextField
T="string"
@bind-Text="@this.dataAPIKey"
Label="@this.APIKeyText"
Disabled="@(!this.DataLLMProvider.IsAPIKeyNeeded(this.DataHost))"
Class="mb-3"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.VpnKey"
AdornmentColor="Color.Info"
InputType="InputType.Password"
Validation="@this.providerValidation.ValidatingAPIKey"
/>

<MudTextField
T="string"
@bind-Text="@this.DataHostname"
Label="Hostname"
Disabled="@(!this.DataLLMProvider.IsHostnameNeeded())"
Class="mb-3"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Dns"
AdornmentColor="Color.Info"
Validation="@this.providerValidation.ValidatingHostname"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
/>

<MudSelect Disabled="@(!this.DataLLMProvider.IsHostNeeded())" @bind-Value="@this.DataHost" Label="Host" Class="mb-3" OpenIcon="@Icons.Material.Filled.ExpandMore" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingHost">
@foreach (Host host in Enum.GetValues(typeof(Host)))
{
if (host.AreEmbeddingsSupported())
{
<MudSelectItem Value="@host">@host.Name()</MudSelectItem>
}
}
</MudSelect>

<MudStack Row="@true" AlignItems="AlignItems.Center">
@if (this.DataLLMProvider.IsEmbeddingModelProvidedManually(this.DataHost))
{
<MudTextField
T="string"
@bind-Text="@this.dataManuallyModel"
Label="Model"
Class="mb-3"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Dns"
AdornmentColor="Color.Info"
Validation="@this.ValidateManuallyModel"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
HelperText="Currently, we cannot query the embedding models of self-hosted systems. Therefore, enter the model name manually."
/>
}
else
{
<MudButton Disabled="@(!this.DataLLMProvider.CanLoadModels(this.DataHost, this.dataAPIKey))" Variant="Variant.Filled" Size="Size.Small" StartIcon="@Icons.Material.Filled.Refresh" OnClick="this.ReloadModels">Load</MudButton>
<MudSelect Disabled="@this.IsNoneProvider" @bind-Value="@this.DataModel" Label="Model" Class="mb-3" OpenIcon="@Icons.Material.Filled.FaceRetouchingNatural" AdornmentColor="Color.Info" Adornment="Adornment.Start" Validation="@this.providerValidation.ValidatingModel">
@foreach (var model in this.availableModels)
{
<MudSelectItem Value="@model">@model</MudSelectItem>
}
</MudSelect>
}
</MudStack>

@* ReSharper disable once CSharpWarnings::CS8974 *@
<MudTextField
T="string"
@bind-Text="@this.DataName"
Label="Instance Name"
Class="mb-3"
MaxLength="40"
Counter="40"
Immediate="@true"
Adornment="Adornment.Start"
AdornmentIcon="@Icons.Material.Filled.Lightbulb"
AdornmentColor="Color.Info"
Validation="@this.providerValidation.ValidatingInstanceName"
UserAttributes="@SPELLCHECK_ATTRIBUTES"
/>

</MudForm>
<Issues IssuesData="@this.dataIssues"/>
</DialogContent>
<DialogActions>
<MudButton OnClick="@this.Cancel" Variant="Variant.Filled">Cancel</MudButton>
<MudButton OnClick="@this.Store" Variant="Variant.Filled" Color="Color.Primary">
@if(this.IsEditing)
{
@:Update
}
else
{
@:Add
}
</MudButton>
</DialogActions>
</MudDialog>
Loading