AI powered solutions | laravel-error-solutions | Spatie

 SPATIE

  Laravel Error Solutions
==========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-error-solutions](https://spatie.be/docs/laravel-error-solutions/v1)  Basic-usage  AI powered solutions

 Version   v1

 Other versions for crawler [v1](https://spatie.be/docs/laravel-error-solutions/v1)

- [ Introduction ](https://spatie.be/docs/laravel-error-solutions/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-error-solutions/v1/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-error-solutions/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-error-solutions/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-error-solutions/v1/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-error-solutions/v1/changelog)
- [ About us ](https://spatie.be/docs/laravel-error-solutions/v1/about-us)

Basic usage
-----------

- [ Displaying solutions ](https://spatie.be/docs/laravel-error-solutions/v1/basic-usage/displaying-solutions)
- [ Runnable solutions ](https://spatie.be/docs/laravel-error-solutions/v1/basic-usage/runnable-solutions)
- [ AI powered solutions ](https://spatie.be/docs/laravel-error-solutions/v1/basic-usage/ai-powered-solutions)

Creating your own solutions
---------------------------

- [ Introduction ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/introduction)
- [ Creating a solution class ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/creating-a-solution-class)
- [ On exceptions ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/on-exceptions)
- [ Via a solution provider ](https://spatie.be/docs/laravel-error-solutions/v1/creating-your-own-solutions/via-a-solution-provider)

 AI powered solutions
====================

The package can send your exceptions to Open AI that will attempt to automatically suggest a solution. In many cases, the suggested solutions is quite useful, but keep in mind that the solution may not be 100% correct for your context.

![image](/docs/laravel-error-solutions/v1/images/ai-solution.png)

To generate AI powered solutions, you must first install this optional dependency.

```
composer require openai-php/client
```

To start sending your errors to OpenAI, you must set `ERROR_SOLUTIONS_OPEN_AI_KEY` in your `.env` file. The value should be your OpenAI key.

These bits of info will be sent to Open AI:

- the error message
- the error class
- the stack frame
- other small bits of info of context surrounding your error

It will not send the request payload or any environment variables to avoid sending sensitive data to OpenAI.
