https://discord.gg/botpress logo
LLM integrations don't support PDF documents - onl...
# 🤝help
w
I've encountered an issue with the LLM integration actions (generateContent) when trying to send PDF documents to language models that natively support them. The Problem: When attempting to send a PDF to Claude (and other LLM providers that support PDFs), the action fails with a media type validation error: Error while executing integration action: Anthropic error 400 (invalid_request_error) - messages.0.content.0.image.source.base64.media_type: Input should be 'image/jpeg', 'image/png', 'image/gif' or 'image/webp'. Current Code:
Copy code
typescriptconst pdfResponse = await axios.get(workflow.payload.url, { responseType: 'arraybuffer' })
const base64Data = Buffer.from(pdfResponse.data).toString('base64')

const response = await actions.anthropic.generateContent({
  model: { id: 'claude-sonnet-4-5-20250929' },
  messages: [{
    role: 'user',
    type: 'multipart',
    content: [
      {
        type: 'image',
        url: `data:application/pdf;base64,${base64Data}`,
        mimeType: 'application/pdf'
      },
      {
        type: 'text',
        text: 'Extract data from this PDF'
      }
    ]
  }],
  temperature: 0.1,
  topP: 0.95
})
Expected Behavior: Many LLM providers now support PDF document processing natively The Botpress LLM integration should support this common use case across all providers that offer it. Could you update the LLM integration input schema to: Add a 'document' content type alongside 'text' and 'image' Accept 'application/pdf' as valid mimeType values Map this correctly to each provider's native document handling format Current Workaround: Bypassing Botpress integrations and calling provider APIs directly with axios, which means losing benefits like credential management, unified error handling, and logging.It affects all LLM providers that support documents (Anthropic, OpenAI, Google)
i'm gonna make also a post in #1111026806254993459