Skip to content

Using content_pdf_file with a chat_openai object #650

Description

@brynhum

I have the following code snippet:

proofreader <- chat_openai(system_prompt = "You are a proofreader.")

proofreader$chat(
  "Find the issues in this file",
  content_pdf_file(fname)
)

Running it yields this error:

Error: Can't find method for generic `as_json(provider, x)`:
- provider: <ellmer::ProviderOpenAI>
- x       : <ellmer::ContentPDF>

I understand from the documentation for content_pdf_file that not all providers support PDF input, but according to OpenAI, direct PDF support was added in March 2025.

Is it possible to hook this up so that content_pdf_file works with chat_openai?

(Additional note: I think the above error message could also be improved to simply say that content_pdf_file is not yet supported for OpenAI chat objects.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions