mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-05 16:49:40 +00:00
Port the Alibaba Cloud families and refuse ambiguous rule inheritance
This commit is contained in:
10 files changed
+285
-3
No files matched your search
@@ -110,6 +110,21 @@ public sealed class ModelFamilyTests
|
||||
Assert.That(refused?.Message, Does.Contain("does not state"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InheritingFromARuleTextWhichNamesTwoRulesSaysSo()
|
||||
{
|
||||
//
|
||||
// Stating one text twice is ordinary: a variant of a generation is written as the same
|
||||
// pattern with a condition on top. What cannot be done afterwards is naming that text to
|
||||
// inherit from, because it no longer names one rule -- and taking whichever came last
|
||||
// would be a coin toss nobody sees.
|
||||
//
|
||||
var family = new FamilyStatingOneTextTwice();
|
||||
var refused = Assert.Throws<InvalidOperationException>(() => _ = family.Rules);
|
||||
|
||||
Assert.That(refused?.Message, Does.Contain("more than once"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AFamilyWhichAdjustsRatherThanChoosesStatesAModifier()
|
||||
{
|
||||
@@ -221,6 +236,20 @@ public sealed class ModelFamilyTests
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FamilyStatingOneTextTwice : ModelFamily
|
||||
{
|
||||
public override ModelVendor Vendor => ModelVendor.UNKNOWN;
|
||||
|
||||
public override ModelSource Source => new("https://example.invalid/twice", new DateOnly(2026, 9, 11), "A family stating one pattern text twice and then naming it to inherit from.");
|
||||
|
||||
protected override void Declare(ModelFamilyBuilder builder)
|
||||
{
|
||||
builder.Rule("thing").Capabilities(Capability.TEXT_INPUT);
|
||||
builder.Rule("thing").AlsoContains("special").Capabilities(Capability.FUNCTION_CALLING);
|
||||
builder.Rule("thing-mini").InheritsFrom("thing");
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class FamilyWithAModifier : ModelFamily
|
||||
{
|
||||
public override ModelVendor Vendor => ModelVendor.UNKNOWN;
|
||||
|
||||
@@ -33,6 +33,7 @@ public sealed class PortingDifferenceTests
|
||||
LLMProviders.ANTHROPIC,
|
||||
LLMProviders.GOOGLE,
|
||||
LLMProviders.MISTRAL,
|
||||
LLMProviders.ALIBABA_CLOUD,
|
||||
];
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user