Skip to content

Commit 8eec075

Browse files
authored
Merge pull request #309 from Portkey-AI/chore/anthropic-pdf
add docs for pdf support for anthropic
2 parents f2f5904 + 21446d5 commit 8eec075

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

integrations/llms/anthropic.mdx

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,20 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
490490
"text": "What are the key findings in this document?"
491491
},
492492
{
493-
"type": "image_url",
494-
"image_url": {
495-
"url": pdf_data
496-
}
493+
"type": "file",
494+
"file": {
495+
# "file_url": "https://pdfobject.com/pdf/sample.pdf", # if you want to pass a pdf file from a url
496+
"mime_type": "application/pdf",
497+
"file_data": "BASE64_PDF_DATA"
498+
}
497499
}
500+
# { # if you want to pass a plain text file
501+
# "type": "file",
502+
# "file": {
503+
# "mime_type": "text/plain",
504+
# "file_data": "This is a plain text file"
505+
# }
506+
# }
498507
]
499508
}
500509
]
@@ -544,11 +553,20 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
544553
text: "What are the key findings in this document?"
545554
},
546555
{
547-
type: "image_url",
548-
image_url: {
549-
url: pdfData
556+
type: "file",
557+
file: {
558+
mime_type: "application/pdf",
559+
file_data: pdfData,
560+
// file_url: "https://pdfobject.com/pdf/sample.pdf" // if you want to pass a pdf file from a url
550561
}
551-
}
562+
},
563+
// { // if you want to pass a plain text file
564+
// "type": "file",
565+
// "file": {
566+
// "mime_type": "text/plain",
567+
// "file_data": "This is a plain text file"
568+
// }
569+
// }
552570
]
553571
}
554572
]
@@ -591,11 +609,19 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
591609
"text": "What are the key findings in this document?"
592610
},
593611
{
594-
"type": "image_url",
595-
"image_url": {
596-
"url": "data:application/pdf;base64,'$PDF_BASE64'"
612+
"type": "file",
613+
"file": {
614+
"mime_type": "application/pdf",
615+
"file_data": "BASE64_PDF_DATA"
597616
}
598617
}
618+
// { // if you want to pass a plain text file
619+
// "type": "file",
620+
// "file": {
621+
// "mime_type": "text/plain",
622+
// "file_data": "This is a plain text file"
623+
// }
624+
// }
599625
]
600626
}
601627
]
@@ -604,10 +630,6 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
604630
</Tab>
605631
</Tabs>
606632
607-
<Note>
608-
We are currently working on enabling direct URL-based PDF support for Anthropic. Stay tuned for updates!
609-
</Note>
610-
611633
612634
### Best Practices for PDF Processing
613635

0 commit comments

Comments
 (0)