Skip to content

Commit 109612a

Browse files
authored
Change default PDF name to "document" for bedrock models (#2545)
We found that claude on Bedrock doesn't like the name `document.pdf`, but `document` is fine. Tested locally.
1 parent c93d39d commit 109612a

File tree

1 file changed

+3
-3
lines changed
  • engine/baml-runtime/src/internal/llm_client/primitive/aws

1 file changed

+3
-3
lines changed

engine/baml-runtime/src/internal/llm_client/primitive/aws/aws_client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ fn media_to_content_block_json(media: &BamlMedia) -> Result<serde_json::Value> {
8989
if let Some(mime) = media.mime_type.as_deref() {
9090
doc_obj.insert("format".into(), json!(strip_mime_prefix(mime)));
9191
}
92-
doc_obj.insert("name".into(), json!("document.pdf"));
92+
doc_obj.insert("name".into(), json!("document"));
9393
doc_obj.insert("source".into(), json!({ "bytes": b64.base64 }));
9494
Ok(json!({ "document": serde_json::Value::Object(doc_obj) }))
9595
}
@@ -1079,7 +1079,7 @@ impl AwsClient {
10791079
Ok(bedrock::types::ContentBlock::Document(
10801080
bedrock::types::DocumentBlock::builder()
10811081
.set_format(Some(bedrock::types::DocumentFormat::Pdf))
1082-
.set_name(Some("document.pdf".to_string())) // Default name for URL-based Pdfs
1082+
.set_name(Some("document".to_string())) // Default name for URL-based Pdfs
10831083
.set_source(Some(bedrock::types::DocumentSource::Bytes(Blob::new(
10841084
url_media.url.as_bytes().to_vec(),
10851085
))))
@@ -1092,7 +1092,7 @@ impl AwsClient {
10921092
Ok(bedrock::types::ContentBlock::Document(
10931093
bedrock::types::DocumentBlock::builder()
10941094
.set_format(Some(bedrock::types::DocumentFormat::Pdf))
1095-
.set_name(Some("document.pdf".to_string())) // Default name for Base64 Pdfs
1095+
.set_name(Some("document".to_string())) // Default name for Base64 Pdfs
10961096
.set_source(Some(bedrock::types::DocumentSource::Bytes(Blob::new(
10971097
aws_smithy_types::base64::decode(b64_media.base64.clone())?,
10981098
))))

0 commit comments

Comments
 (0)