openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.99k stars 523 forks source link

chore: handle all UnhandledMatchErrors #467

Open chris-lee-lb opened 3 months ago

chris-lee-lb commented 3 months ago

What:

Description:

Our sentry has been logged many times UnhandledMatchError with class ThreadRunStepResponseToolCallsStepDetails.

截圖 2024-08-20 下午6 57 08

So this PR try to throw wrapped exception like ThreadRunStreamResponse does for all matches.

Related:

N/A

gehrisandro commented 3 months ago

Hi @chris-lee-lb

Thank you for your PR.

In my opinion, it would be better to handle the types properly instead of throwing an exception.

The problem is, that according to the specs, there shouldn't be a different type.

Could you please provide some steps to reproduce the issue?

chris-lee-lb commented 1 month ago

@gehrisandro sorry for later reply.

And unfortunately we can not reproduce the issue easily, we only occasionally see this error in our sentry platform (https://www.sentry.io), but the sentry doesn't record what http response was actually received, so I can't give you any further debug information.

So my intention of this PR is to use the new Exception to allow the sentry to record the unprocessed type content, so that it can be continuously corrected.