mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-05 00:29:40 +00:00
improved stability of embedding chunks
This commit is contained in:
1 parent
1bf9328fb9
commit
759c7f9d89
3 files changed
+37
-3
No files matched your search
@@ -424,7 +424,20 @@ public sealed partial class DataSourceEmbeddingService(SettingsManager settingsM
|
||||
dataSource.Id);
|
||||
|
||||
var texts = batch.Select(item => item.Text).ToList();
|
||||
var vectors = await provider.EmbedTextAsync(embeddingProvider.Model, settingsManager, token, texts);
|
||||
IReadOnlyList<IReadOnlyList<float>> vectors;
|
||||
try
|
||||
{
|
||||
vectors = await provider.EmbedTextAsync(embeddingProvider.Model, settingsManager, token, texts);
|
||||
}
|
||||
catch (OperationCanceledException) when (token.IsCancellationRequested)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
throw new InvalidOperationException($"The embedding provider failed to embed {batch.Count} chunk(s) for file '{file.Name}'. Provider message: {exception.Message}", exception);
|
||||
}
|
||||
|
||||
if (vectors.Count != batch.Count)
|
||||
throw new InvalidOperationException($"The embedding provider returned {vectors.Count} vectors for {batch.Count} text chunks.");
|
||||
|
||||
|
||||
Reference in new issue
Block a user