Skip to content

add docs for pdf support for anthropic #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 37 additions & 15 deletions integrations/llms/anthropic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -490,11 +490,20 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
"text": "What are the key findings in this document?"
},
{
"type": "image_url",
"image_url": {
"url": pdf_data
}
"type": "file",
"file": {
# "file_url": "https://pdfobject.com/pdf/sample.pdf", # if you want to pass a pdf file from a url
"mime_type": "application/pdf",
"file_data": "BASE64_PDF_DATA"
}
}
# { # if you want to pass a plain text file
# "type": "file",
# "file": {
# "mime_type": "text/plain",
# "file_data": "This is a plain text file"
# }
# }
]
}
]
Expand Down Expand Up @@ -544,11 +553,20 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
text: "What are the key findings in this document?"
},
{
type: "image_url",
image_url: {
url: pdfData
type: "file",
file: {
mime_type: "application/pdf",
file_data: pdfData,
// file_url: "https://pdfobject.com/pdf/sample.pdf" // if you want to pass a pdf file from a url
}
}
},
// { // if you want to pass a plain text file
// "type": "file",
// "file": {
// "mime_type": "text/plain",
// "file_data": "This is a plain text file"
// }
// }
]
}
]
Expand Down Expand Up @@ -591,11 +609,19 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
"text": "What are the key findings in this document?"
},
{
"type": "image_url",
"image_url": {
"url": "data:application/pdf;base64,'$PDF_BASE64'"
"type": "file",
"file": {
"mime_type": "application/pdf",
"file_data": "BASE64_PDF_DATA"
}
}
// { // if you want to pass a plain text file
// "type": "file",
// "file": {
// "mime_type": "text/plain",
// "file_data": "This is a plain text file"
// }
// }
]
}
]
Expand All @@ -604,10 +630,6 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f
</Tab>
</Tabs>

<Note>
We are currently working on enabling direct URL-based PDF support for Anthropic. Stay tuned for updates!
</Note>


### Best Practices for PDF Processing

Expand Down