From 21446d5a44302464be5267fcf457156030505c9d Mon Sep 17 00:00:00 2001 From: Narendranath Gogineni Date: Wed, 30 Apr 2025 20:26:16 +0530 Subject: [PATCH] add docs for pdf support for anthropic --- integrations/llms/anthropic.mdx | 52 +++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/integrations/llms/anthropic.mdx b/integrations/llms/anthropic.mdx index ce46671..6cd4c78 100644 --- a/integrations/llms/anthropic.mdx +++ b/integrations/llms/anthropic.mdx @@ -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" + # } + # } ] } ] @@ -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" + // } + // } ] } ] @@ -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" + // } + // } ] } ] @@ -604,10 +630,6 @@ Currently, Portkey supports PDF processing using base64-encoded PDF documents, f - - We are currently working on enabling direct URL-based PDF support for Anthropic. Stay tuned for updates! - - ### Best Practices for PDF Processing