Skip to content

refactor!: improve types in platform api #376

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jul 6, 2025
Merged

Conversation

chr-hertel
Copy link
Member

@chr-hertel chr-hertel commented Jul 4, 2025

I was just tired of doing those assert($response instanceof ...); statements
also resolves the special status of AsyncResponse by decoupling it from the ResponseInterface

WDYT?

@chr-hertel chr-hertel added the BC BREAK Backwards compatibility break label Jul 4, 2025
Copy link

@smnandre smnandre left a comment

Choose a reason for hiding this comment

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

I like this very much... it does have its own drawbacks, but I feels it's by far the best way out of this situation, and it clarifies a lot of things on a DX level

@DZunke
Copy link
Contributor

DZunke commented Jul 5, 2025

This looks pretty cool! Thanks @chr-hertel - those assertions you mentioned are all over the place and this looks like a cool solution. Mostly one knows what kind of request was sent and what should be the response but for type safety checks where required. Wrapping those checks to the library with the ResponsePromise feels like a good step forward!

@chr-hertel chr-hertel force-pushed the refactor-platform-types branch from 77d71aa to 5471c77 Compare July 5, 2025 23:00
@chr-hertel chr-hertel marked this pull request as ready for review July 5, 2025 23:02
@chr-hertel chr-hertel force-pushed the refactor-platform-types branch from 5471c77 to b2e94eb Compare July 5, 2025 23:32
@chr-hertel
Copy link
Member Author

This PR demonstrates the benefits for lib users quite well I guess:
https://github.com/php-llm/llm-chain-symfony-demo/pull/29/files

@chr-hertel chr-hertel merged commit cb6fc83 into main Jul 6, 2025
7 checks passed
@chr-hertel chr-hertel deleted the refactor-platform-types branch July 6, 2025 17:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
BC BREAK Backwards compatibility break refactor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants