Skip to content

Add provider hook for preparing function declarations - #280

Open
zahidgh wants to merge 1 commit into
WordPress:trunkfrom
zahidgh:issue-256-provider-function-preparation
Open

Add provider hook for preparing function declarations#280
zahidgh wants to merge 1 commit into
WordPress:trunkfrom
zahidgh:issue-256-provider-function-preparation

Conversation

@zahidgh

@zahidgh zahidgh commented Aug 22, 2026

Copy link
Copy Markdown

Summary

  • add a protected no-op hook for preparing function declarations before serialization
  • invoke the hook from the shared OpenAI-compatible tools path
  • add unit coverage proving a provider override can adapt a declaration

Provider APIs accept different subsets of JSON Schema for tool input parameters. This hook lets a provider normalize its own declarations without changing the canonical FunctionDeclaration DTO or affecting the default payload.

Fixes #256

Validation

  • composer test:unit — 1,165 tests, 4,262 assertions
  • composer lint — PHPCS and PHPStan pass
  • git diff --check

AI assistance disclosure

AI assistance was used for drafting and test scaffolding. The implementation and validation were reviewed before submission.

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: zahidgh <zahidui@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.50%. Comparing base (a31b0ec) to head (5a1247a).

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk     #280   +/-   ##
=========================================
  Coverage     86.49%   86.50%           
- Complexity     1327     1328    +1     
=========================================
  Files            68       68           
  Lines          4295     4298    +3     
=========================================
+ Hits           3715     3718    +3     
  Misses          580      580           
Flag Coverage Δ
unit 86.50% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow providers to prepare function declarations before tool-calling requests

1 participant