Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Conversation

@Iyadhfaleh
Copy link
Contributor

I think json_decode is better to handle responses APIs .
"toArray" method will throw exception when status code >= 300 .

@Iyadhfaleh Iyadhfaleh force-pushed the fix/replace-toArray-methods branch from d258be3 to d2d826f Compare December 16, 2024 12:29
@Iyadhfaleh Iyadhfaleh changed the title [FIX] Replace toArray methods , use json_decode instead [FIX] Don't throw client exception Dec 16, 2024
@chr-hertel
Copy link
Member

So, first of all thanks and I do agree that error handling is currently not in great shape.

the code that you added is mostly sitting on top of the expected json/array structure - which is a valid addition, but i doesn't help with 4xx/5xx situations, since everything is converted to a runtime exception and context of the original error or unexpected behavior would get lost.

i consider the structural changes that you check and error handling with RuntimeException a valuable addition, but would still keep the toArray() with throwing exceptions. nevertheless, this should be improved but rather in a different layer. and without loosing the original exception information.

this was the original handling, which is broken since i introduced the AsyncResponse i guess...
https://github.com/php-llm/llm-chain/blob/main/src/Platform.php#L44-L54

Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Let's focus on the additional RuntimeExceptions - they are a good addition and provide value. Thanks for that!

@Iyadhfaleh Iyadhfaleh changed the title [FIX] Don't throw client exception [FIX] Handle responses errors Dec 17, 2024
@Iyadhfaleh Iyadhfaleh force-pushed the fix/replace-toArray-methods branch from b5c8506 to e20eda1 Compare December 17, 2024 14:35
@Iyadhfaleh Iyadhfaleh force-pushed the fix/replace-toArray-methods branch from e20eda1 to 1fb7102 Compare December 17, 2024 14:37
@Iyadhfaleh
Copy link
Contributor Author

Thank you for your review and your feedbacks @chr-hertel. I applied your suggestions

@OskarStark OskarStark changed the title [FIX] Handle responses errors Handle response errors Dec 17, 2024
@OskarStark OskarStark added the enhancement New feature or request label Dec 17, 2024
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

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

Thank you @Iyadhfaleh

@chr-hertel chr-hertel merged commit a817561 into php-llm:main Dec 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants