Skip to content

The json schema definition at toolConfig.tools.10.toolSpec.inputSchema is invalid #3731

Open
@cristiursachi

Description

@cristiursachi

Describe the bug

I'm trying to use the new AWSSDK.Extensions.Bedrock.MEAI extensions but I get a server side error:

The json schema definition at toolConfig.tools.10.toolSpec.inputSchema is invalid. Fix the following errors and try again: $.properties: null found, object expected

This is thrown when I use an AITool in ChatOptions as following:

IChatClient client = runtime.AsChatClient("us.anthropic.claude-3-7-sonnet-20250219-v1:0");

 ChatOptions chatOptions = new ChatOptions();
 
  AITool toolInLine = MyTools.GetAITestTool();

  chatOptions.Tools.Add(toolInLine);

 client.GetStreamingResponseAsync(messages,chatOptions);

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

I should get a valid response from Bedrock LLM and invoke the AITool if required. But despite if the prompt will require or not the call to AITool, I get the the exception which seems generated on serverSide.

Current Behavior

This is the full exception I get:

Amazon.BedrockRuntime.Model.ValidationException
  HResult=0x80131500
  Message=The json schema definition at toolConfig.tools.10.toolSpec.inputSchema is invalid. Fix the following errors and try again: $.properties: null found, object expected
  Source=AWSSDK.Core
  StackTrace:
   at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleExceptionStream(IRequestContext requestContext, IWebResponseData httpErrorResponse, HttpErrorResponseException exception, Stream responseStream) in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\HttpErrorResponseExceptionHandler.cs:line 163
   at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.<HandleExceptionAsync>d__2.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\HttpErrorResponseExceptionHandler.cs:line 92
   at Amazon.Runtime.Internal.ExceptionHandler`1.<HandleAsync>d__6.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ExceptionHandler.cs:line 46
   at Amazon.Runtime.Internal.ErrorHandler.<ProcessExceptionAsync>d__8.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 205
   at Amazon.Runtime.Internal.ErrorHandler.<InvokeAsync>d__5`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\ErrorHandler\ErrorHandler.cs:line 103
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
   at Amazon.Runtime.Internal.Signer.<InvokeAsync>d__1`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\Signer.cs:line 59
   at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\EndpointDiscoveryHandler.cs:line 80
   at Amazon.Runtime.Internal.EndpointDiscoveryHandler.<InvokeAsync>d__2`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\EndpointDiscoveryHandler.cs:line 90
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\RetryHandler\RetryHandler.cs:line 135
   at Amazon.Runtime.Internal.RetryHandler.<InvokeAsync>d__10`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\RetryHandler\RetryHandler.cs:line 150
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
   at Amazon.Runtime.Internal.BaseAuthResolverHandler.<InvokeAsync>d__2`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\BaseAuthResolverHandler.cs:line 47
   at Amazon.Runtime.Internal.CallbackHandler.<InvokeAsync>d__9`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\CallbackHandler.cs:line 61
   at Amazon.Runtime.Internal.ErrorCallbackHandler.<InvokeAsync>d__5`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\ErrorCallbackHandler.cs:line 53
   at Amazon.Runtime.Internal.MetricsHandler.<InvokeAsync>d__1`1.MoveNext() in C: \source\repos\aws-sdk-net-4\sdk\src\Core\Amazon.Runtime\Pipeline\Handlers\MetricsHandler.cs:line 93
   at Amazon.BedrockRuntime.BedrockChatClient.<GetStreamingResponseAsync>d__7.MoveNext() in C: \source\repos\aws-sdk-net-4\extensions\src\AWSSDK.Extensions.Bedrock.MEAI\BedrockChatClient.cs:line 158
   at Amazon.BedrockRuntime.BedrockChatClient.<GetStreamingResponseAsync>d__7.System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult(Int16 token)
   at ASI_AutoRemedy.Program.<Main>d__0.MoveNext() in C: \source\repos\ASI_AutoRemedy\ASI_AutoRemedy\Program.cs:line 79
   at ASI_AutoRemedy.Program.<Main>d__0.MoveNext() in C: \source\repos\ASI_AutoRemedy\ASI_AutoRemedy\Program.cs:line 79

  This exception was originally thrown at this call stack:
    Amazon.Runtime.HttpWebRequestMessage.ProcessHttpResponseMessage(System.Net.Http.HttpResponseMessage) in HttpRequestMessageFactory.cs
    Amazon.Runtime.HttpWebRequestMessage.GetResponseAsync(System.Threading.CancellationToken) in HttpRequestMessageFactory.cs
    Amazon.Runtime.Internal.HttpHandler<TRequestContent>.InvokeAsync<T>(Amazon.Runtime.IExecutionContext) in HttpHandler.cs
    Amazon.Runtime.Internal.Unmarshaller.InvokeAsync<T>(Amazon.Runtime.IExecutionContext) in Unmarshaller.cs
    Amazon.Runtime.Internal.ErrorHandler.InvokeAsync<T>(Amazon.Runtime.IExecutionContext) in ErrorHandler.cs

Inner Exception 1:
HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.

Reproduction Steps

IChatClient client = runtime.AsChatClient("us.anthropic.claude-3-7-sonnet-20250219-v1:0");

 ChatOptions chatOptions = new ChatOptions();
 
  AITool toolInLine = MyTools.GetAITestTool();

  chatOptions.Tools.Add(toolInLine);

 client.GetStreamingResponseAsync(messages,chatOptions);

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK.Extensions.Bedrock.MEAI - 4.0.0-preview.11

Targeted .NET Platform

.NET Core 3.1

Operating System and version

Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExtensionsbugThis issue is a bug.p2This is a standard priority issuequeued

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions