Skip to content

Conversation

@felixarntz
Copy link
Member

Important: This is built on top of #27. That PR must be reviewed and merged first.

@felixarntz felixarntz added this to the 0.2.0 milestone Nov 30, 2025
@felixarntz felixarntz added the [Feature] New feature to highlight in changelogs. label Nov 30, 2025
@felixarntz felixarntz modified the milestones: 0.2.0, 0.2.1 Dec 1, 2025
@felixarntz
Copy link
Member Author

@JasonTheAdams Punted this to 0.2.1. It's technically an enhancement, but doesn't justify a 0.3.0. Neither is it blocking the 0.2.0 release.

Would be great to get it merged in the next couple days.

Base automatically changed from add/js-api to trunk December 1, 2025 23:48
@felixarntz felixarntz modified the milestones: 0.2.1, 0.2.2 Dec 6, 2025
Copy link
Member

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

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

Really nice, @felixarntz! Left a couple comments and questions. 😄

* modelId: string
* }
*/
class AI_Providers_Models_REST_Controller {
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about extending the WP_REST_Controller so we can make use of its built-in functionality including links so we can do things like embedding models with a controller response?

Copy link
Member Author

Choose a reason for hiding this comment

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

The WP_REST_Controller implementation is honestly not great for implementing general controllers. It is extremely opinionated in terms of CRUD endpoints, i.e. it only works well for a set of endpoints that allow CRUD operations for a single resource (which neither of the endpoints in the WP AI Client fit into). For any other kind of endpoint, extending WP_REST_Controller means implementing a ton of methods with just some stub "This is not implemented."

I'm not sure why we would need links here. Can you clarify what you mean by "embedding models with a controller response"? If we want to do this, maybe something we can do in a follow up issue/PR?

Copy link
Member

Choose a reason for hiding this comment

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

I get what you mean. I can't say I've ever found it particularly painful for things like this, but it's fine. I only thought of it because it makes HAL linking easy.

I mistyped when I wrote "embedding models with a controller response". What I meant was embedding models within a provider response. So I could do /providers/google?_embed=models and have the models for that provider included in the response so I can one-shot it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, that makes sense.

Adding those links in order to embed sub-results is pretty straightforward even without the WP_REST_Controller base class. How about we open an issue for this? I'm happy to take this on, but would love to unblock this main piece here.

Copy link
Member

Choose a reason for hiding this comment

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

Sure! It's certainly not a blocker. 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I opened #39 for that 👍

Copy link
Member

@JasonTheAdams JasonTheAdams left a comment

Choose a reason for hiding this comment

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

Looks good, @felixarntz! 👍

@felixarntz felixarntz modified the milestones: 0.2.2, 0.3.0 Dec 11, 2025
@felixarntz felixarntz merged commit dacb6e8 into trunk Dec 11, 2025
9 checks passed
@felixarntz felixarntz deleted the add/providers-models-js-api branch December 11, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] New feature to highlight in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants