examples/config-pdf-files/README.md
This example demonstrates how to analyze PDF documents using vision-capable LLMs from multiple providers.
You can run this example with:
npx promptfoo@latest init --example config-pdf-files
cd config-pdf-files
Set your API keys for the providers you want to use:
GOOGLE_API_KEY or GEMINI_API_KEYANTHROPIC_API_KEYOPENAI_API_KEYThis example is pre-configured in promptfooconfig.yaml. Run:
promptfoo eval
View results:
promptfoo view
The prompt.py file handles provider-specific PDF formatting:
document content type with base64 datainput_file with data URI formatinline_data within message partsEach provider has different requirements for sending PDF documents, which is why a Python prompt function is used to dynamically format the request.