A developer needs Claude to analyze both the text and the visual layout, charts, and images on each page of a PDF report, not just extract raw text. According to Anthropic's documentation, how is a PDF supplied to the Messages API?
- PDFs cannot be sent as input to the Messages API at all; the developer's own application must first convert the PDF to plain text before any part of it can be included in a request
- a message's content array can include a block of type `document`, whose source can be a base64-encoded PDF, a URL pointing to a hosted PDF, or a `file_id` from the Files API, letting the model reason over both the extracted text and each page's visual layout, charts, and images
- PDFs are supported only via a separate proprietary file format that the developer must first produce from the PDF using a vendor-provided offline conversion tool before uploading
- the `document` content block only extracts and returns the PDF's raw text back to the developer as a standalone response; it cannot be used as part of a prompt for the model to reason over
Why B? And why not the others?
Correct answer: B. a message's content array can include a block of type `document`, whose source can be a base64-encoded PDF, a URL pointing to a hosted PDF, or a `file_id` from the Files API, letting the model reason over both the extracted text and each page's visual layout, charts, and images
Anthropic's documentation describes a `document` content block that accepts a PDF either as base64-encoded data, as a URL referencing a hosted PDF, or as a `file_id` obtained from the Files API, and states that because PDF support relies on Claude's vision capabilities, each page is processed as both text and image, so the model can reason over charts, tables, and layout in addition to extracted text rather than text alone. The option claiming PDFs cannot be sent at all is directly contradicted by this documented feature. The option requiring a proprietary offline conversion format invents a step that the documented base64, URL, and Files API options make unnecessary. The option describing the block as only returning raw text back to the developer misdescribes it as an extraction utility rather than as prompt content the model itself reasons over within the same request.
Source: Anthropic, PDF support documentation, https://platform.claude.com/docs/en/build-with-claude/pdf-support