This package helps user to fix typos in email addresses by using openai api to suggest a valid email address.
sfolador/ai-email-suggest is a Laravel package for this package helps user to fix typos in email addresses by using openai api to suggest a valid email address..
It currently has 5 GitHub stars and 21 downloads on Packagist (latest version 1.0.10).
Install it with composer require sfolador/ai-email-suggest.
Discover more Laravel packages by sfolador
or browse all Laravel packages to compare alternatives.
Last updated
This package provides a simple way to suggest email addresses based on a given email address. The typical use case is when a user enters an email address with typos, i.e.: [email protected]. This package uses OpenAI to suggest an email addresses that are likely to be correct.
You can install the package via composer:
composer require sfolador/ai-email-suggest
You can publish the config file with:
php artisan vendor:publish --tag="ai-email-suggest-config"
This is the contents of the published config file:
return [
'model' => 'text-davinci-003',
'openai_key' => env('OPENAI_KEY'),
'default_route' => 'ai-email-suggest',
'use_cache' => true,
// If you want to use the chatgpt API,
// you need to set the following value to true:
'use_chatgpt_api' => false,
'throttle' => [
'enabled' => false,
'max_attempts' => 60,
'prefix' => 'ai-email-suggest',
],
];
Remember to set your OpenAI key in your .env file.
$aiEmailSuggest = AiEmailSuggest::suggest('[email protected]');
// $aiEmailSuggest = '[email protected]'
It's possible to use this package from the frontend by invoking the route: "/ai-email-suggest" in POST by passing the email as a parameter. The response will be a JSON with the suggested email, such as:
{
"suggestion": "[email protected]"
}
If you use a Cache driver that supports tags, you can clear the cache by invoking the command:
php artisan ai-email-suggest:clear-cache
You can use the new ChatGPT API by setting the config value use_chatgpt_api to true.
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.