PDF and Document Processing
Sending PDFs to Claude, extracting data from multi-page documents, and forms / contracts analysis.
Şükrü Yusuf KAYA
11 min read
IntermediatePDF Akışı
PDF'leri Claude'a iki yolla verebilirsin:
- Doğrudan PDF input — API ile PDF dosyasını gönder.
- Dönüştürerek — sayfa sayfa görsel veya text olarak işle.
İlk yöntem daha pratik; ikinci yöntem büyük PDF'lerde token tasarrufu sağlar.
python
# Doğrudan PDF input — API'daimport anthropic, base64, pathlibclient = anthropic.Anthropic() pdf_b64 = base64.standard_b64encode(pathlib.Path("contract.pdf").read_bytes()).decode() resp = client.messages.create( model="claude-sonnet-4-6", max_tokens=4096, messages=[{ "role":"user", "content":[ {"type":"document","source":{"type":"base64","media_type":"application/pdf","data":pdf_b64}}, {"type":"text","text":"Sözleşmedeki cezai şart maddelerini madde numaralarıyla çıkar."}, ], }],)print(resp.content[0].text)PDF'yi 'document' tipi olarak yolla — Claude sayfa sayfa görür.
Boşluk doldur · text
PDF işleme akışında doğrudan _____ tipi mesaj gönderilebilir. Büyük PDF'lerde _____ - _____ stratejisi daha güvenlidir. Yapısal alan çıkarımında JSON _____ kullanılır.Frequently Asked Questions
You need to remove the password first (if authorized). Claude cannot decrypt them.
Yorumlar & Soru-Cevap
(0)Yorum yazmak için giriş yap.
Yorumlar yükleniyor...