mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-04 18:07:21 +00:00
Allowed the Batch Processing assistant to process images (#1087)
Co-authored-by: Thorsten Sommer <SommerEngineering@users.noreply.github.com>
This commit is contained in:
1 parent
5d6e48ef93
commit
e019c24ea2
19 files changed
+429
-31
No files matched your search
@@ -0,0 +1,20 @@
|
||||
using AIStudio.Settings.DataModel;
|
||||
using AIStudio.Tools.Rust;
|
||||
|
||||
namespace AIStudio.Tests.Settings;
|
||||
|
||||
public class DataBatchProcessingTests
|
||||
{
|
||||
/// <summary>
|
||||
/// The default patterns are a constant and cannot be built from FileTypes, so this keeps both
|
||||
/// lists of the images we hand to the model in step.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void DefaultPatternsHoldEveryImageTheModelCanRead()
|
||||
{
|
||||
var patterns = DataBatchProcessing.DEFAULT_FILE_PATTERNS.Split(';');
|
||||
var imagePatterns = FileTypes.MODEL_IMAGE.FlattenExtensions().Select(extension => $"*.{extension}");
|
||||
|
||||
Assert.That(patterns, Is.SupersetOf(imagePatterns));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using AIStudio.Provider;
|
||||
using AIStudio.Settings;
|
||||
|
||||
namespace AIStudio.Tests.Settings;
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a configured model counts as able to read images.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Attaching a file to a chat, building a request, and the Batch Processing assistant all ask this one
|
||||
/// question. A limit of zero images is a statement about the installation, so it has to win over the
|
||||
/// capability, while a limit nobody stated must not take anything away.
|
||||
/// </remarks>
|
||||
[TestFixture]
|
||||
public sealed class ImageInputSupportTests
|
||||
{
|
||||
private const string MACHINE = "55555555-5555-5555-5555-555555555555";
|
||||
|
||||
/// <summary>
|
||||
/// A model the rules know as reading text only, so that every image capability comes from the overrides.
|
||||
/// </summary>
|
||||
private static readonly Model MODEL = new("llama3.3:70b", null);
|
||||
|
||||
[Test]
|
||||
public void AModelWithoutImageCapabilityCannotReadImages()
|
||||
{
|
||||
Assert.That(ProviderWith(null).SupportsImageInput(), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnImageCapabilityWithoutAStatedLimitReadsImages()
|
||||
{
|
||||
Assert.That(ProviderWith(new() { MultipleImageInput = true }).SupportsImageInput(), Is.True, "Nobody stated a limit, and an unknown limit takes nothing away.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ALimitOfOneImageStillReadsImages()
|
||||
{
|
||||
Assert.That(ProviderWith(new() { MultipleImageInput = true, MaxImagesPerMessage = 1 }).SupportsImageInput(), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ALimitOfZeroImagesPerMessageTakesTheCapabilityBack()
|
||||
{
|
||||
Assert.That(ProviderWith(new() { MultipleImageInput = true, MaxImagesPerMessage = 0 }).SupportsImageInput(), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ALimitOfZeroImagesPerRequestTakesTheCapabilityBack()
|
||||
{
|
||||
Assert.That(ProviderWith(new() { MultipleImageInput = true, MaxImagesPerRequest = 0 }).SupportsImageInput(), Is.False, "A message cannot carry more images than its whole request.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A configured self-hosted provider, the way the settings hold one.
|
||||
/// </summary>
|
||||
/// <param name="overrides">What the person switched, or nothing when they switched nothing.</param>
|
||||
/// <returns>The configured provider.</returns>
|
||||
private static AIStudio.Settings.Provider ProviderWith(ProviderCapabilityOverrides? overrides) => new(1, MACHINE, "A machine of my own", LLMProviders.SELF_HOSTED, MODEL, IsSelfHosted: true)
|
||||
{
|
||||
CapabilityOverrides = overrides,
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user