Citations are not supported in tool result documents.
Describe the bug
When using the Bedrock Converse API with tool use, documents returned in tool results cannot have citations enabled, despite the boto3 documentation indicating this field is available.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-runtime/client/converse.html#converse
Based on the documentation request can have: toolResult > content > document > citations
Regression Issue
- [ ] Select this option if this issue appears to be a regression.
Expected Behavior
The request does not raise an error or documentation reflects that citations are not available in tool results
Current Behavior
The request raises:
ValidationException: An error occurred (ValidationException) when calling the Converse operation: Citations are not supported in tool result documents.
Reproduction Steps
import boto3
client = boto3.client("bedrock-runtime", region_name="us-east-1")
messages = [
{"role": "user", "content": [{"text": "What color is the sky?"}]},
{
"role": "assistant",
"content": [
{"toolUse": {"toolUseId": "tool_1", "name": "get_info", "input": {}}}
],
},
{
"role": "user",
"content": [
{
"toolResult": {
"toolUseId": "tool_1",
"content": [
{
"document": {
"format": "txt",
"name": "doc",
"source": {"bytes": b"The sky is blue, the grass is green."},
"citations": {"enabled": True}
}
}
],
}
}
],
},
]
response = client.converse(
modelId="anthropic.claude-3-sonnet-20240229-v1:0",
messages=messages,
toolConfig={
"tools": [
{
"toolSpec": {
"name": "get_info",
"description": "Get information",
"inputSchema": {"json": {"type": "object"}},
}
}
]
},
)
response
Possible Solution
No response
Additional Information/Context
No response
SDK version used
1.40.59
Environment details (OS name and version, etc.)
mac OS 15.6.1
Hi @itogaston, thanks for reaching out. I can definitely see how this would be misleading. I've reached out to the service team about documenting this restriction somewhere, either in the API reference or in their user guide.
Regarding the Boto3 documentation, this is a common nuance of AWS documentation in general. When a parameter is reused across multiple operations, the request and response syntax will show every possible value of that parameter. However, not every operation accepts or returns every possible value of that parameter, and you often need to check the parameter documentation, or reference an example, to get more information.
Ticket # for internal use : P340469135
Hello and thanks for your work.
I am wondering if there are any plans to add support for citations on tool results. This feature is now supported by Anthropic, and it would be very useful to have similar capabilities in boto3. Is this something that’s on the roadmap or being considered?
Thanks!
This feature is now supported by Anthropic, and it would be very useful to have similar capabilities in boto3.
Boto3's support for this feature is dependent on Bedrock's support for it in general. I've forwarded this feedback to the service team for their consideration.