awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition())),ToolCapableProvider(),ToolOfferBlockReason.NONE,"A tool-capable, highly trusted provider and a tool which needs nothing.");
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition())),provider,ToolOfferBlockReason.MODEL_CANNOT_USE_TOOLS,"The person said their model cannot call functions.");
}
[Test]
publicasyncTaskNoProviderSelected()
{
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition())),AIStudio.Settings.Provider.NONE,ToolOfferBlockReason.MODEL_CANNOT_USE_TOOLS,"Without a provider there is no model that could call a tool.");
}
[Test]
publicasyncTaskAToolNotMeantForTheChat()
{
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition(visibleInChat:false))),ToolCapableProvider(),ToolOfferBlockReason.NOT_AVAILABLE_HERE,"The tool belongs to the assistants only.");
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition()){IsAvailable=false}),ToolCapableProvider(),ToolOfferBlockReason.NOT_AVAILABLE_HERE,"The tool belongs to a preview the user did not switch on.");
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition())),ToolCapableProvider(),ToolOfferBlockReason.TOOL_SWITCHED_OFF,"The organization turned this one tool off.");
}
[Test]
publicasyncTaskAToolMissingASetting()
{
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition(requiresSetting:true))),ToolCapableProvider(),ToolOfferBlockReason.NOT_CONFIGURED,"The tool cannot work without a setting nobody filled in.");
}
[Test]
publicasyncTaskAProviderTrustedTooLittle()
{
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition(minimumConfidence:ConfidenceLevel.HIGH))),LessTrustedProvider(),ToolOfferBlockReason.PROVIDER_CONFIDENCE_TOO_LOW,"The tool asks for high confidence, the provider has a moderate one.");
awaitthis.AssertBothAgree(this.CreateRegistry(newTestTool(Definition())),LessTrustedProvider(),ToolOfferBlockReason.PROVIDER_CONFIDENCE_TOO_LOW,"The tool asks for nothing itself, but its requirement was raised in the settings.");
Assert.That(runnableTools.Any(x=>x.Definition.Id==TOOL_ID),Is.EqualTo(expectedisToolOfferBlockReason.NONE),"Preparing the request has to come to the same answer as asking beforehand.");