https://www.boundaryml.com logo
Unable to test PDFs with Bedrock
# help
client Sonnet3_7BedrockInvoices { provider aws-bedrock options { model "us.anthropic.claude-3-7-sonnet-20250219-v1:0" region "us-east-1" inference_configuration { max_tokens 8192 temperature 0 } additional_model_request_fields { citations {"enabled": true} } } }
g
I'll try changing the hardcoded name from document.pdf to document and see if that fixes the issue. If so, I'll get a PR up and we'll aim to have it in for the Tuesday night release.
Do you need the
additional_model_request_fields { citations { enabled true } }
? I've found that changing the default document name from "document.pdf" to "document" does fix the issue you were seeing, but only if I remove
additional_model_request_fields
. When I run with
additional_model_request_fields
, I get a validation error from Bedrock: "The model returned the following errors: citations: Extra inputs are not permitted".
m
according to this blog post we do need that, but maybe I am passing it incorrectly: https://builder.aws.com/content/2yuuUoj0uthPd6M3GR7t2SZ4r8E/claude-pdf-support-on-amazon-bedrock
g
Ahh, I see.
{citations: { enabled: "true" } }
switches the model from Converse (text-only) mode, to Claude PDF Chat Mode (which visually analyzes the PDF). Your PDFs likely won't get extracted as nicely if we can't pass this in. I'm reading about additional_model_request_fields now to see if it should let us pass
citations
in the way you were using it.
Ok, I believe additional_model_request_fields passes its data only to the top-level inference request. It will not inject its contents into individual message blocks, but the
citations
object does need to be used at the level of the document message (not the top-level inference request). It may be safe to hardcode this too, for the time being at least. We haven't settled on a syntax for allowing modification of Pdf values within BAML the language.
m
Okay great! Glad that it can be hardcoded. Is there a good way for me to pass in the citations param to each message block?
g
We don't have a way to customize the blocks. But every PDF block going to Bedrock after the upcoming release (which I'm working on now) will have citations enabled.
0.210.0 release just came out. Please give it a try on your BAML code when you can, Mike 🙂