-
Notifications
You must be signed in to change notification settings - Fork 9
Add REST endpoints and JS store and API to get information about AI providers and models #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@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. |
JasonTheAdams
left a comment
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. 👍
There was a problem hiding this comment.
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 👍
JasonTheAdams
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, @felixarntz! 👍
Important: This is built on top of #27. That PR must be reviewed and merged first.