- Newest
- Most votes
- Most comments
This appears to be a bug in the Amazon Bedrock Converse API's handling of large integers when using tool configurations with JSON schemas.
Based on your detailed reproduction, there seems to be inconsistent behavior with integer handling in tool inputs:
- Integers below 2^31 (2147483648) are accepted but converted to strings
- Integers at or above 2^31 and at 2^32 cause the entire tool input to be dropped (empty object)
- Very large integers (2^53-1 and above) are accepted but coerced to strings
This behavior appears to be consistent across different models (both Llama 3.1 and Mistral Large), suggesting it's an issue with the Bedrock Converse API's JSON schema validation rather than model-specific.
For your specific use case with epoch-millisecond timestamps, the current workaround would be to:
- Define your schema properties as "type": "string" instead of "type": "integer"
- Handle the string-to-integer conversion in your application code after receiving the response
This issue appears similar to other known quirks with the Converse API, such as problems with escaping quotes in tool calls. Since this seems to be a bug in the service rather than expected behavior, opening a support ticket with AWS would be the recommended approach to get an official response regarding the expected integer width support and timeline for a fix.
For now, using string types in your schema and handling the conversion in your application is likely the most reliable approach until this issue is addressed.
Sources
Llama 3.1 Converse calls not properly escaping quotes in tool calls | AWS re:Post
Bedrock Converse API - Consistent Timeout Issue with Larger models like Anthropic Sonnet 3.5 and Meta Llama 405B | AWS re:Post
answered a year ago
Hello,
Q 1: What integer width does the Converse tool input validator support for "type":"integer"? (Should be at least int64.) Answer : I'd like to kindly note that "integer" is actually not a supported JSON schema type - we currently use "number". However, the good news is that we now support a broader range of numerical values.
Q 2: Why are some large values coerced to strings while others are dropped? Is this a known issue with the global validator or a model-adapter quirk? Answer: This behavior is actually a model-specific characteristic rather than a validator issue.
Q 3: Is there a supported schema hint (e.g., format: int64) that Converse honors to prevent dropping values? Answer: Unfortunately, at this time there isn't a supported schema hint available for this purpose.
Q 4: Can AWS confirm and provide an ETA or recommended best practice for 64-bit integer tool parameters (e.g., epoch-ms)? Answer: While we understand the importance of this feature, we regrettably don't have a specific timeline to share at the moment. We're continuously working to improve our services and appreciate your patience on this matter.
Thank you.
answered 10 months ago
Relevant content
- AWS OFFICIALUpdated 3 years ago
