Skip to content

Bedrock Playground vs Bedrock API: Different PDF Embedded URL handling

0

Hi,

we're trying to use AWS Bedrock service to extract images from a PDF. The PDF contains thumbnails with embedded remote URLs to the full size images.

Example: AWS Bedrock PDF Upload and Prompt Example

For the Bedrock API we implemented following workflow in NodeJs. Download File from S3, having the "Body" as Base64 uploaded to the Bedrock API.

const { BedrockRuntimeClient, InvokeModelCommand } = require("@aws-sdk/client-bedrock-runtime");

const command = new InvokeModelCommand({ modelId: "arn:aws:bedrock:eu-central-1:ACCOUNTID:inference-profile/eu.anthropic.claude-3-7-sonnet-20250219-v1:0", contentType: "application/json", accept: "application/json", body: JSON.stringify(payload), });

The response is that it can see the images, descriptions etc. but can not find the URL. It describes the images though, so it seems the visible content is extracted, but not the embedded information.

Thanks for any advice what might be the reason for the different handling of PDF via Chat/Playground and API!

asked a year ago379 views

1 Answer
0

The difference in behavior you're experiencing between the Bedrock Playground and the Bedrock API regarding embedded URLs in PDFs is related to a recent feature enhancement in Amazon Bedrock Data Automation (BDA).

According to recent updates, Amazon Bedrock Data Automation now supports extraction of embedded hyperlinks when processing documents in Standard Output. This feature specifically enables BDA to detect and return embedded hyperlinks found in PDFs as part of the standard output, enhancing information extraction capabilities and preserving valuable link references.

When you use the Bedrock Playground, it likely leverages this enhanced document processing capability automatically. However, when using the direct API approach with InvokeModelCommand, you're bypassing some of these document preprocessing features.

For your NodeJS implementation, you're using the basic model invocation which doesn't automatically apply the same document processing enhancements. The model can see and describe the visible content (images, text) but doesn't have access to the embedded URL metadata.

To resolve this issue, you might want to:

  1. Consider using Amazon Bedrock Data Automation services directly if you specifically need to extract embedded hyperlinks from PDFs
  2. Ensure you're using the latest version of the AWS SDK for JavaScript
  3. Check if there are specific parameters or preprocessing steps you can add to your API call to enable enhanced document processing

The model can only work with what's visually present in the document when using the basic API approach, while the Playground might be applying additional document processing capabilities behind the scenes.
Sources
Amazon Bedrock Data Automation now supports modality controls, hyperlinks and larger documents - AWS

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.