mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-05 04:27:21 +00:00
Fixed Semantic Search with external data sources (ERI servers) (#1090)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
0f5b041729
commit
f6e48e95f3
30 files changed
+1370
-141
No files matched your search
@@ -0,0 +1,50 @@
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.Services;
|
||||
|
||||
namespace AIStudio.Tests.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// Checks which ERI data sources whose server could not be reached may still be named to a provider.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Such a data source is never searched, but Semantic Search tells the model about it, so that the
|
||||
/// model does not take its silence for finding nothing. Its server's requirements are unknown then,
|
||||
/// so only the security policy configured in AI Studio decides, and a provider which that policy
|
||||
/// keeps away must not even learn the name.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class DataSourceUnreachableTests
|
||||
{
|
||||
[TestCase(true)]
|
||||
[TestCase(false)]
|
||||
public void ADataSourceForAnyProviderMayBeNamed(bool usingTrustedProvider)
|
||||
{
|
||||
Assert.That(DataSourceService.MayBeNamedWhileUnreachable(ERISource(DataSourceSecurity.ALLOW_ANY), usingTrustedProvider), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ADataSourceForSelfHostedProvidersIsNamedOnlyToATrustedOne()
|
||||
{
|
||||
var source = ERISource(DataSourceSecurity.SELF_HOSTED);
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(DataSourceService.MayBeNamedWhileUnreachable(source, usingTrustedProvider: true), Is.True);
|
||||
Assert.That(DataSourceService.MayBeNamedWhileUnreachable(source, usingTrustedProvider: false), Is.False, "The data source would be refused to this provider if its server answered.");
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ADataSourceWithoutASecurityPolicyIsNeverNamed()
|
||||
{
|
||||
Assert.That(DataSourceService.MayBeNamedWhileUnreachable(ERISource(DataSourceSecurity.NOT_SPECIFIED), usingTrustedProvider: true), Is.False, "Better safe than sorry, as with a server which answers.");
|
||||
}
|
||||
|
||||
private static DataSourceERI_V1 ERISource(DataSourceSecurity securityPolicy) => new()
|
||||
{
|
||||
Id = "33333333-3333-3333-3333-333333333333",
|
||||
Name = "Intranet",
|
||||
Type = DataSourceType.ERI_V1,
|
||||
SecurityPolicy = securityPolicy,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user