openai-php / client

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

Adds RequestHandled event #286

Open gehrisandro opened 10 months ago

gehrisandro commented 10 months ago

This PR adds the ability register an event dispatcher.

When a request has been handled successfully and an event dispatcher is registered, a RequestHandled event will be dispatched. The event contains the initial Payload of the request and the Response.

This feature is required to create a Recorder for Laravel Pulse in the openai/laravel repository.

Todos:

cleptric commented 3 months ago

Besides the Laravel Pulse use-case, we got some people asking to instrument this library in our Sentry Laravel SDK. Is there any appetite to move forward with this PR?