WordPress / WordPress/php-ai-client

Sending PDF files using the `$builder->with_file()` method is not working.

Open
#165 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
308
Forks
84
Avg merge
7d 21h
Merged PRs (30d)
2

Description

In a message I posted to the core-ai Slack channel, I wrote:

"Does wp-ai-client support .pdf files via the $builder->with_file( $file_path, $mime_type) method?
When I try this, I get the following message: "No models were found that support text rendering for this request."
Thanks in advance for your help."

In response, @JasonTheAdams posted the change he made here:

https://github.com/WordPress/php-ai-client/pull/161/commits/437d0d978cae73333bfc1c7ccce0337790514873

To test it, I manually added the following code snippets to the OpenAiModelMetadataDirectory and GoogleModelMetadataDirectory files.

[ModalityEnum::text(), ModalityEnum::document()],
[ModalityEnum::text(), ModalityEnum::image(), ModalityEnum::document()],

The "Model not found..." error no longer occurs. However, the error "Unsupported MIME type for inline file message section: "application/pdf" is returned now.

I think a general adjustment regarding file processing is needed.

Here is the Github repo of my project: https://github.com/Arkenon/orchestrator-for-wp-ai-client

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with OpenAiModelMetadataDirectory and GoogleModelMetadataDirectory, then trace how $builder->with_file() processes MIME types. Reproduce the application/pdf case and follow the existing file-processing path to identify where PDF support is rejected. Done means PDF files no longer produce the unsupported MIME type error for supported models.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.