Issue #3586448: Add ChatWithPdf capability to AiModelCapability enum

Description

Add ChatWithPdf = 'chat_with_pdf' to the AiModelCapability enum so provider plugins can advertise PDF-in-chat support and consumers can require it.

The new case is wired into all three match arms:

  • getBaseOperationType()'chat'
  • getTitle()'Chat with PDF'
  • getDescription()'Is set if the chat model can include PDF documents in the chat input.'

Scope: enum addition only. Provider plugins (Anthropic, Gemini, OpenAI) that support PDF input can opt in to the new capability separately.

Testing instructions

  1. Enable the ai module on a Drupal site.
  2. In a provider plugin's getSupportedCapabilities() method, return AiModelCapability::ChatWithPdf.
  3. Verify AiModelCapability::ChatWithPdf->getBaseOperationType() returns 'chat', getTitle() returns 'Chat with PDF', and getDescription() returns the expected string.
  4. Alternatively, run: php -r "require 'vendor/autoload.php'; var_dump(\Drupal\ai\Enum\AiModelCapability::ChatWithPdf->getTitle());"

Checklist

  • I have linked the related issue in the MR title or description
  • I have performed a self-review of my own code
  • I have added or updated tests, or explained in the description why this change is not covered by tests
  • I have updated documentation for any new or changed functionality
  • I have written testing instructions and verified them locally
  • I have noted any required post-merge steps (config imports, cache rebuilds, manual changes)
  • This MR contains no breaking API or hook changes, or they are explicitly documented in the description

AI Compliance

Note

Check the one that best describes your usage, or leave all unchecked if AI was not significantly used.

  • AI Assisted Code
    Mainly written by a human; AI used for autocomplete or partial generation under full human supervision.

  • AI Generated Code
    Mainly generated by AI, reviewed and approved by a human before this MR was created.

  • Vibe Coded
    Generated by AI and only functionally reviewed before this MR was created.

Closes #3586448 (closed)

Edited by Abhisek Mazumdar

Merge request reports

Loading