mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-23 07:53:48 +00:00
Moved the background agents to AI operations (#1215)
This commit is contained in:
1 parent
8a4a26503b
commit
c50a93cd17
139 files changed
+4069
-2340
No files matched your search
@@ -0,0 +1,51 @@
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.Services;
|
||||
|
||||
namespace AIStudio.Tests.Tools;
|
||||
|
||||
/// <summary>
|
||||
/// Checks which AI operations count as seeing the data of the data sources.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Every provider which sees the data must be trusted enough for every data source it sees. That
|
||||
/// cuts both ways: leaving out an operation which does run would send data to a provider trusted too
|
||||
/// little, while counting an operation which does not run holds back data sources for no reason. The
|
||||
/// classic RAG process runs its AI operations; Semantic Search runs none, since the chat model picks the
|
||||
/// data sources and judges the passages itself.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class DataSourceParticipatingOperationsTests
|
||||
{
|
||||
[Test]
|
||||
public void SemanticSearchRunsNoOperation()
|
||||
{
|
||||
var operations = DataSourceService.GetParticipatingOperations(Options(automaticSelection: true, automaticValidation: true), DataSourceRetrievalMode.SEMANTIC_SEARCH, retrievalContextValidationEnabled: true);
|
||||
|
||||
Assert.That(operations, Is.Empty, "The chat provider alone sees the data, so its trust alone decides which data sources it may search.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheClassicRAGProcessCountsTheOperationsItRuns()
|
||||
{
|
||||
var operations = DataSourceService.GetParticipatingOperations(Options(automaticSelection: true, automaticValidation: true), DataSourceRetrievalMode.EVERY_MESSAGE, retrievalContextValidationEnabled: true);
|
||||
|
||||
Assert.That(operations.Select(operation => operation.Component), Is.EqualTo(new[] { AIStudio.Tools.Components.AGENT_DATA_SOURCE_SELECTION, AIStudio.Tools.Components.AGENT_RETRIEVAL_CONTEXT_VALIDATION }));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheClassicRAGProcessCountsNoOperationItDoesNotRun()
|
||||
{
|
||||
using (Assert.EnterMultipleScope())
|
||||
{
|
||||
Assert.That(DataSourceService.GetParticipatingOperations(Options(automaticSelection: false, automaticValidation: false), DataSourceRetrievalMode.EVERY_MESSAGE, retrievalContextValidationEnabled: true), Is.Empty);
|
||||
Assert.That(DataSourceService.GetParticipatingOperations(Options(automaticSelection: false, automaticValidation: true), DataSourceRetrievalMode.EVERY_MESSAGE, retrievalContextValidationEnabled: false), Is.Empty, "The validation of this chat is on, but the settings switch it off everywhere.");
|
||||
}
|
||||
}
|
||||
|
||||
private static DataSourceOptions Options(bool automaticSelection, bool automaticValidation) => new()
|
||||
{
|
||||
DisableDataSources = false,
|
||||
AutomaticDataSourceSelection = automaticSelection,
|
||||
AutomaticValidation = automaticValidation,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user