AI-Studio/app/Tests/Models/OpenAI/NewOpenAIModelTests.cs
Thorsten Sommer 8dbe459a53
Some checks are pending
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
Fixed GPT-6 Sol and Luna, and the system prompt role of newer OpenAI models (#1010)
2026-09-27 19:13:54 +02:00

69 lines
2.9 KiB
C#

using AIStudio.Models;
using AIStudio.Provider;
using AIStudio.Settings;
// ReSharper disable InconsistentNaming
namespace AIStudio.Tests.Models.OpenAI;
/// <summary>
/// Checks what AI Studio assumes about an OpenAI model released after its rules were written.
/// </summary>
/// <remarks>
/// OpenAI releases faster than anybody writes rules, and a new generation is always reached by
/// somebody first. What that person must get is what every current OpenAI model does: it calls
/// tools, it looks at images, it reasons, and it answers through the Responses API. The global
/// assumption says none of that except the tools, and it sends the model to the chat completion
/// API, where a parameter meant for the Responses API is turned down.
///
/// The names below are invented on purpose. A real name belongs in the corpus; these stand for the
/// one nobody has seen yet, which is exactly the name no corpus can hold.
/// </remarks>
[TestFixture]
public sealed class NewOpenAIModelTests
{
[TestCase("gpt-99", TestName = "A generation nobody wrote a rule for")]
[TestCase("gpt-99-mini", TestName = "A variant of a generation nobody wrote a rule for")]
public void ANewOpenAIModelIsAnsweredLikeTheCurrentOnes(string modelId)
{
var profile = LLMProviders.OPEN_AI.GetModelProfile(new Model(modelId, null));
Assert.Multiple(() =>
{
Assert.That(profile.Has(Capability.RESPONSES_API), Is.True);
Assert.That(profile.Has(Capability.FUNCTION_CALLING), Is.True);
Assert.That(profile.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.True);
Assert.That(profile.Reasoning, Is.Not.EqualTo(ReasoningSupport.NONE));
});
}
[Test]
public void TheOpenWeightsKeepTheirOwnRuleEvenAtOpenAI()
{
//
// How a pattern matches is weighed before how long it is. Written as a prefix, the
// baseline would outrank the name part "gpt-oss" and hand the open weights reasoning and
// the Responses API. OpenAI does not serve them today; the test is about which rule wins.
//
var profile = LLMProviders.OPEN_AI.GetModelProfile(new Model("gpt-oss-120b", null));
Assert.Multiple(() =>
{
Assert.That(profile.Has(Capability.RESPONSES_API), Is.False);
Assert.That(profile.Reasoning, Is.EqualTo(ReasoningSupport.NONE));
Assert.That(profile.Context.DefaultTokens, Is.EqualTo(131_072));
});
}
[Test]
public void AModelNamedGptElsewhereIsNotTakenForAnOpenAIModel()
{
var profile = LLMProviders.SELF_HOSTED.GetModelProfile(new Model("gpt-j-6b", null));
Assert.Multiple(() =>
{
Assert.That(profile.Has(Capability.RESPONSES_API), Is.False);
Assert.That(profile.Has(Capability.MULTIPLE_IMAGE_INPUT), Is.False);
Assert.That(profile.Reasoning, Is.EqualTo(ReasoningSupport.NONE));
});
}
}