mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-14 07:33:48 +00:00
Let tools take a list of strings as an argument
This commit is contained in:
3 files changed
+95
No files matched your search
@@ -45,6 +45,21 @@ public sealed class OpenAIStrictToolSchemaTests
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AnOptionalListMayBeNullWhileItsEntriesKeepTheirChoice()
|
||||
{
|
||||
var dataSourceIds = Converted(ToolParameterSchemaBuilder.Create()
|
||||
.RequiredString("query", "The search query.")
|
||||
.OptionalStringArray("data_source_ids", "The data sources.", "first", "second"))["properties"]!["data_source_ids"]!;
|
||||
|
||||
Assert.Multiple(() =>
|
||||
{
|
||||
Assert.That(Types(dataSourceIds), Is.EqualTo(["array", "null"]), "Leaving the list out is said by allowing null for the list itself.");
|
||||
Assert.That(dataSourceIds["items"]!["enum"]!.AsArray().Select(value => value?.GetValue<string>()), Is.EqualTo(["first", "second"]), "Null is a way to leave the list out, not an entry it may hold.");
|
||||
Assert.That(dataSourceIds["enum"], Is.Null, "The list itself names no values of its own.");
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ARequiredArgumentStaysAsItIs()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user