One change
pdf-support
build-with-claude/pdf-support
Nearest release: v2.1.239, published 2 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
build-with-claude/pdf-support Changed · +9 / -12 lines
from line 425
```python Python import base64 - import httpx + import httpx2 # First, load and encode the PDF pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" pdf_data = base64.standard_b64encode( - httpx.get(pdf_url, follow_redirects=True).content + httpx2.get(pdf_url, follow_redirects=True).content ).decode("utf-8") # Alternative: Load from a local file
from line 941
``` ```php PHP - // The PHP SDK exposes the Files API under the beta namespace; field names can differ from other SDKs. - // The PHP SDK supports file_id document and image sources only through $client->beta->messages with the files beta. use Anthropic\Core\FileParam; $client = new Client(); // Upload the PDF file - $file_upload = $client->beta->files->upload( + $file_upload = $client->files->upload( file: FileParam::fromResource(fopen('/path/to/document.pdf', 'r'), contentType: 'application/pdf'), ); // Use the uploaded file in a message - $message = $client->beta->messages->create( + $message = $client->messages->create( maxTokens: 1024, - betas: ['files-api-2025-04-14'], messages: [ [ 'role' => 'user',
from line 961
'type' => 'document', 'source' => [ 'type' => 'file', - 'file_id' => $file_upload->id, + 'fileID' => $file_upload->id, ], ], [
from line 1120
```python Python import base64 - import httpx + import httpx2 # First, load and encode the PDF pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" pdf_data = base64.standard_b64encode( - httpx.get(pdf_url, follow_redirects=True).content + httpx2.get(pdf_url, follow_redirects=True).content ).decode("utf-8") # Create a message with the cached document
from line 1488
```python Python import base64 - import httpx + import httpx2 # First, load and encode the PDF pdf_url = "https://assets.anthropic.com/m/1cd9d098ac3e6467/original/Claude-3-Model-Card-October-Addendum.pdf" pdf_data = base64.standard_b64encode( - httpx.get(pdf_url, follow_redirects=True).content + httpx2.get(pdf_url, follow_redirects=True).content ).decode("utf-8") # Create a batch of requests that use the document