Skip to content

Adds support for Provider HTTP Handling #47

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

Merged
merged 42 commits into from
Aug 15, 2025

Conversation

JasonTheAdams
Copy link
Member

Waiting on: #46

This introduces an HTTP system to the Providers framework so models can send requests to the Provider API.

This is built to not depend on a specific HTTP Client (e.g. Guzzle), but instead is happy to work with any PSR-18 compatible Client. It also uses the HTTPlug set of packages to improve auto-discovery of said client.

When we go to implement this into the WordPress system, this will allow us to make our own client that uses (and navigate the quirks of) the WP request functions.

@JasonTheAdams JasonTheAdams mentioned this pull request Aug 7, 2025
13 tasks
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@JasonTheAdams Overall this looks like a great start - it gives me really clean software vibes which I love 😆

A few points of feedback on the interfaces and DTOs mostly. The high level approach looks awesome.

@JasonTheAdams JasonTheAdams marked this pull request as ready for review August 12, 2025 20:33
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@JasonTheAdams Overall this looks quite solid. A few more points of feedback.

@felixarntz felixarntz added this to the Finish the foundation milestone Aug 13, 2025
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

One additional caveat here regarding header handling.

Either we simply transform all header names always to lowercase, or we define some approach of merging while trying to maintain the original casing, e.g.:

  • Keep header name in its original casing.
  • For lookup of whether there's a conflict, we always check in a case-insensitive way (we already have the lowercase lookup map for that).
  • If there's an attempt to set another header that case-insensitive would have the same name as an existing header, set its values under the new header name and remove the old header name.

It might not be a bad idea to have a single-purpose Headers class that handles all this case-insensitive while maintaining original case lookup and setting in a central place. Not a must have, just an idea.

SomeProviderTextGenerationModel --> HttpTransporterInterface : uses
SomeProviderTextGenerationModel --> Request : creates
SomeProviderTextGenerationModel --> Response : receives
```
Copy link
Member

Choose a reason for hiding this comment

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

There is a lot of very detailed documentation in here. Maybe that's helpful, but I'm a bit wary of this getting out of date because of how precise and verbose it is. Do we really want to keep all of this in here? If so, have you verified it's up to date with the latest changes you've been making to the actual code in this PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops! I don't know why it did that. Good catch! Resolved in 577327a

Copy link
Member

Choose a reason for hiding this comment

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

@JasonTheAdams This comment was not about the embeddings :)

Copy link
Member Author

Choose a reason for hiding this comment

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

My bad. I mixed it up with the other comment.

Honestly, I'm not married to the extra docs at all. I wasn't sure if having it would help Extenders better understand how to use the HttpTransporter and DTOs. But you're right that it's more to maintain, and I'm not convinced in its value. I'm happy to remove this if you think it's best.

Copy link
Member

Choose a reason for hiding this comment

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

I would say the initial sections, including the Mermaid sequence diagram, are definitely worth keeping. IMO mainly the additional very detailed class diagrams could be removed, because:

  • they would mean more substantial additional maintenance keeping it up to date
  • they have some overlap with the detailed class diagrams above in the file that are already in place

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@JasonTheAdams This looks really close. A few last points of feedback, most importantly I think we should treat the body (string) as source of truth for the Request. The $data constructor parameter and class property are fully interoperable with it and purely provide an easy layer to set and get raw data.

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@JasonTheAdams Two last follow up comments that I think should be addressed. But they should be quick.

I'm going to tentatively approve, and feel free to merge without another review after you've addressed them. If you have any concerns, let me know. Awesome work, I'm really happy to see this final piece of the foundation land. 🍻

@JasonTheAdams JasonTheAdams merged commit 7dcd982 into trunk Aug 15, 2025
4 checks passed
@JasonTheAdams JasonTheAdams deleted the add-http-client-and-auth branch August 15, 2025 18:19
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.

2 participants