mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-18 07:17:59 +00:00
Added mailboxes as local data sources (#1022)
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
Build and Release / Determine run mode (push) Waiting to run
Build and Release / Read metadata (push) Blocked by required conditions
Build and Release / Sync Flatpak repo (push) Blocked by required conditions
Build and Release / Collect Flatpak artifacts (push) Blocked by required conditions
Build and Release / Verify (push) Waiting to run
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-apple-darwin, osx-arm64, macos-latest, aarch64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-pc-windows-msvc.exe, win-arm64, windows-latest, aarch64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-aarch64-unknown-linux-gnu, linux-arm64, ubuntu-22.04-arm, aarch64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-apple-darwin, osx-x64, macos-latest, x86_64-apple-darwin, dmg,app,updater, dmg) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-pc-windows-msvc.exe, win-x64, windows-latest, x86_64-pc-windows-msvc, nsis,updater, nsis) (push) Blocked by required conditions
Build and Release / Build app (${{ matrix.dotnet_runtime }}) (-x86_64-unknown-linux-gnu, linux-x64, ubuntu-22.04, x86_64-unknown-linux-gnu, appimage,updater, appimage) (push) Blocked by required conditions
Build and Release / Prepare & create release (push) Blocked by required conditions
Build and Release / Publish release (push) Blocked by required conditions
This commit is contained in:
1 parent
93be539e50
commit
c4400c0ff6
343 files changed
+26051
-3122
No files matched your search
@@ -87,6 +87,23 @@ public sealed class EmbeddingSignatureTests
|
||||
"The same model name served by another backend is another vector source.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnIndexedDataSourceOutsideDataSourcesIsCutByItsOwnSettings()
|
||||
{
|
||||
var directory = DataSource(ConfidenceLevel.LOW);
|
||||
var elsewhere = new IndexedElsewhere
|
||||
{
|
||||
EmbeddingId = directory.EmbeddingId,
|
||||
MaxChunkTokenLength = directory.MaxChunkTokenLength,
|
||||
ChunkOverlapTokenLength = directory.ChunkOverlapTokenLength,
|
||||
};
|
||||
|
||||
Assert.That(
|
||||
DataSourceEmbeddingService.BuildEmbeddingSignature(elsewhere, EmbeddingProviderFor("text-embedding-3-small")),
|
||||
Is.EqualTo(Signature(directory)),
|
||||
"The chunking follows the indexed settings alone. Asking for IInternalDataSource instead would cut such a data source at the token limit of the provider, without anybody noticing.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheSignatureOfAKnownConfigurationIsPinned()
|
||||
{
|
||||
@@ -96,6 +113,41 @@ public sealed class EmbeddingSignatureTests
|
||||
"Reordering or extending the signature throws away every index anybody has. This test makes that a decision somebody takes rather than something which happens on the way past.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheSignatureOfAMailboxIsPinned()
|
||||
{
|
||||
var mailbox = new DataSourceMailbox
|
||||
{
|
||||
Id = "0c3f9b52-7d4e-4a1b-9e6f-2b8c5d7a1e40",
|
||||
EmbeddingId = "b0a4c4d2-1f3e-4f0a-8c9d-5a6b7c8d9e01",
|
||||
MaxChunkTokenLength = 512,
|
||||
ChunkOverlapTokenLength = 100,
|
||||
};
|
||||
|
||||
Assert.That(
|
||||
DataSourceEmbeddingService.BuildEmbeddingSignature(mailbox, EmbeddingProviderFor("text-embedding-3-small")),
|
||||
Is.EqualTo("2|b0a4c4d2-1f3e-4f0a-8c9d-5a6b7c8d9e01|OPEN_AI|text-embedding-3-small|NONE|http://localhost:1234|NONE||8192|512|100|mail:2|attachments:10"),
|
||||
"The text of a mail has a version of its own, which rebuilds the mailboxes and nothing else. Every other data source keeps the signature pinned above.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReadingOtherAttachmentsRebuildsAMailbox()
|
||||
{
|
||||
var embeddingProvider = EmbeddingProviderFor("text-embedding-3-small");
|
||||
var mailbox = new DataSourceMailbox { EmbeddingId = embeddingProvider.Id, MaxAttachmentSizeMegabytes = 10 };
|
||||
var signature = DataSourceEmbeddingService.BuildEmbeddingSignature(mailbox, embeddingProvider);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(DataSourceEmbeddingService.BuildEmbeddingSignature(mailbox with { MaxAttachmentSizeMegabytes = 20 }, embeddingProvider), Is.Not.EqualTo(signature), "The mails indexed before would never get their larger attachments.");
|
||||
Assert.That(DataSourceEmbeddingService.BuildEmbeddingSignature(mailbox with { IndexAttachments = false }, embeddingProvider), Does.EndWith("|attachments:none"));
|
||||
Assert.That(
|
||||
DataSourceEmbeddingService.BuildEmbeddingSignature(mailbox with { IndexAttachments = false, MaxAttachmentSizeMegabytes = 20 }, embeddingProvider),
|
||||
Is.EqualTo(DataSourceEmbeddingService.BuildEmbeddingSignature(mailbox with { IndexAttachments = false }, embeddingProvider)),
|
||||
"A limit which reads nothing threw the index away for nothing.");
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds the signature the way an indexing run does, working the chunking out along the way.
|
||||
/// </summary>
|
||||
@@ -130,4 +182,30 @@ public sealed class EmbeddingSignatureTests
|
||||
|
||||
private static EmbeddingProvider EmbeddingProviderFor(string modelId) =>
|
||||
new(1, "b0a4c4d2-1f3e-4f0a-8c9d-5a6b7c8d9e01", "Test embeddings", LLMProviders.OPEN_AI, new(modelId, modelId));
|
||||
|
||||
/// <summary>
|
||||
/// A data source which is embedded but not kept in DataSources, the way mailboxes are.
|
||||
/// </summary>
|
||||
private readonly record struct IndexedElsewhere() : IIndexedDataSource
|
||||
{
|
||||
public string Id => "0c3f9b52-7d4e-4a1b-9e6f-2b8c5d7a1e40";
|
||||
|
||||
public uint Num => 2;
|
||||
|
||||
public string Name => "Indexed elsewhere";
|
||||
|
||||
public bool IsEnterpriseConfiguration => false;
|
||||
|
||||
public Guid EnterpriseConfigurationPluginId => Guid.Empty;
|
||||
|
||||
public DataSourceType Type { get; init; } = DataSourceType.NONE;
|
||||
|
||||
public ConfidenceLevel ConfidenceLevel { get; init; } = ConfidenceLevel.LOW;
|
||||
|
||||
public string EmbeddingId { get; init; } = Guid.Empty.ToString();
|
||||
|
||||
public int MaxChunkTokenLength { get; init; }
|
||||
|
||||
public int ChunkOverlapTokenLength { get; init; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user