diff --git a/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/AWSSDK.Extensions.Bedrock.MEAI.nuspec b/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/AWSSDK.Extensions.Bedrock.MEAI.nuspec index 66f6c9157c99..556bec0a8dd0 100644 --- a/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/AWSSDK.Extensions.Bedrock.MEAI.nuspec +++ b/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/AWSSDK.Extensions.Bedrock.MEAI.nuspec @@ -3,7 +3,7 @@ AWSSDK.Extensions.Bedrock.MEAI AWSSDK - Bedrock integration with Microsoft.Extensions.AI. - 4.0.1.0 + 4.0.1.1 Amazon Web Services Implementations of Microsoft.Extensions.AI's abstractions for Bedrock. en-US diff --git a/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/BedrockChatClient.cs b/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/BedrockChatClient.cs index 86dfdac81149..a47b708ea9db 100644 --- a/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/BedrockChatClient.cs +++ b/extensions/src/AWSSDK.Extensions.Bedrock.MEAI/BedrockChatClient.cs @@ -592,7 +592,7 @@ private static string GetMimeType(VideoFormat? format) => /// Converts a to a . private static Document DictionaryToDocument(IDictionary? arguments) { - Document inputs = default; + Document inputs = new Document(new Dictionary()); if (arguments is not null) { foreach (KeyValuePair argument in arguments) @@ -704,6 +704,21 @@ private static Document ToDocument(JsonElement json) } } + var schemaDictionary = new Dictionary() + { + ["type"] = new Document("object"), + }; + + if (inputs != default) + { + schemaDictionary["properties"] = inputs; + } + + if (required.Count > 0) + { + schemaDictionary["required"] = new Document(required); + } + return new Tool() { ToolSpec = new ToolSpecification() @@ -712,12 +727,7 @@ private static Document ToDocument(JsonElement json) Description = !string.IsNullOrEmpty(f.Description) ? f.Description : f.Name, InputSchema = new() { - Json = new(new Dictionary() - { - ["type"] = new Document("object"), - ["properties"] = inputs, - ["required"] = new Document(required), - }) + Json = new(schemaDictionary) }, }, };