Skip to content

feat: add DocumentCapableInterface for PDF/document support - #117

Merged
just-tobi merged 2 commits into
mainfrom
feature/document-capable-interface
Mar 18, 2026
Merged

feat: add DocumentCapableInterface for PDF/document support#117
just-tobi merged 2 commits into
mainfrom
feature/document-capable-interface

Conversation

@just-tobi

Copy link
Copy Markdown
Contributor

Summary

  • Introduces DocumentCapableInterface with supportsDocuments(): bool and getSupportedDocumentFormats(): array
  • ClaudeProvider and GeminiProvider implement the interface, both declaring PDF support
  • Allows consumers (e.g. nr-mcp-agent) to query document capability per-provider instead of hardcoding format lists
  • OpenAiProvider does not implement the interface — PDF upload via OpenAI requires the Files API and is not supported

Test plan

  • ClaudeProviderTest: supportsDocumentsReturnsTrue, getSupportedDocumentFormatsReturnsPdf
  • GeminiProviderTest: same tests
  • Existing provider tests remain green

Copilot AI review requested due to automatic review settings March 18, 2026 18:01
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a robust mechanism for LLM providers to declare and communicate their document processing capabilities. By defining a new DocumentCapableInterface, it standardizes the way applications can determine if a provider supports document uploads and which formats are accepted. The ClaudeProvider and GeminiProvider have been updated to conform to this interface, specifically enabling PDF document support, which allows for more flexible and maintainable integration with external services that require document interaction.

Highlights

  • New Interface for Document Capability: A new interface, DocumentCapableInterface, has been introduced to standardize how LLM providers declare their support for document processing and list supported formats.
  • Claude and Gemini Provider Updates: ClaudeProvider and GeminiProvider now implement the DocumentCapableInterface, explicitly indicating their support for PDF documents.
  • Enhanced Provider Querying: This change allows consumers to dynamically query LLM providers for their document capabilities, removing the need to hardcode supported formats.
  • Unit Test Coverage: New unit tests have been added for both ClaudeProvider and GeminiProvider to ensure the correct functionality of the new document capability methods.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

github-actions[bot]
github-actions Bot previously approved these changes Mar 18, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval for solo maintainer project

This PR has passed all automated quality gates:

  • ✅ Static analysis (PHPStan)
  • ✅ Code style (PHP-CS-Fixer)
  • ✅ Unit & functional tests
  • ✅ Security scanning
  • ✅ Dependency review

See SECURITY_CONTROLS.md for compensating controls documentation.

@github-actions github-actions Bot added tests Test-related changes providers LLM provider changes labels Mar 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully introduces the "DocumentCapableInterface" to standardize how LLM providers declare their document processing capabilities. The implementation in "ClaudeProvider" and "GeminiProvider" is straightforward and correctly reflects their PDF support. The accompanying unit tests provide good coverage for the new functionality. Overall, this is a well-structured and valuable feature addition.

Comment thread Classes/Provider/Contract/DocumentCapableInterface.php Outdated
@codecov

codecov Bot commented Mar 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.89%. Comparing base (047a553) to head (4430742).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #117   +/-   ##
=========================================
  Coverage     93.88%   93.89%           
- Complexity     2137     2141    +4     
=========================================
  Files            82       82           
  Lines          7589     7597    +8     
=========================================
+ Hits           7125     7133    +8     
  Misses          464      464           
Flag Coverage Δ
unit 93.89% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
Classes/Provider/ClaudeProvider.php 95.28% <100.00%> (+0.05%) ⬆️
Classes/Provider/GeminiProvider.php 99.45% <100.00%> (+<0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a provider-level capability contract for document (PDF) support so consumers can query support per provider instead of hardcoding format lists.

Changes:

  • Introduces DocumentCapableInterface with supportsDocuments() and getSupportedDocumentFormats().
  • Implements the interface in ClaudeProvider and GeminiProvider, both reporting PDF support.
  • Extends unit tests for Claude/Gemini providers to cover document capability and to assert PDF is not treated as an image format.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Classes/Provider/Contract/DocumentCapableInterface.php New capability contract to expose document support and formats.
Classes/Provider/ClaudeProvider.php Implements document capability methods and declares PDF support.
Classes/Provider/GeminiProvider.php Implements document capability methods and declares PDF support.
Tests/Unit/Provider/ClaudeProviderTest.php Adds unit tests for document capability + ensures image formats exclude PDF.
Tests/Unit/Provider/GeminiProviderTest.php Adds unit tests for document capability + ensures image formats exclude PDF.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@just-tobi
just-tobi added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit ca352e4 Mar 18, 2026
37 checks passed
@just-tobi
just-tobi deleted the feature/document-capable-interface branch March 18, 2026 18:33

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated approval for solo maintainer project

This PR has passed all automated quality gates:

  • ✅ Static analysis (PHPStan)
  • ✅ Code style (PHP-CS-Fixer)
  • ✅ Unit & functional tests
  • ✅ Security scanning
  • ✅ Dependency review

See SECURITY_CONTROLS.md for compensating controls documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

providers LLM provider changes tests Test-related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants