naif/ai-validation

AI Validator for Laravel: Uses ChatGPT (GPT-3.5-turbo) to easily check and filter user inputs.

dev-master 2024-01-22 17:15 UTC

This package is not auto-updated.

Last update: 2024-11-12 19:41:37 UTC


README

AI Validator for Laravel: Uses ChatGPT (GPT-3.5-turbo) to easily check and filter user inputs.

Requirements

  • PHP 7.2 or higher
  • Laravel 6.0 or higher
  • Open AI API Key

Installation

You can install the package into a Laravel app via composer:

composer require naif/ai-validation

Publish config file

php artisan vendor:publish --provider="Naif\AIValidation\AIValidationServiceProvider" 

OpenAI API Key

Create your API Key from https://platform.openai.com/api-keys

Add API Key in .env file

CHATGPT_API_KEY=

Usage

Field validation rule

use Naif\AIValidation\Rules\AIValidation;

$request->validate([
    'field_name' => [AIValidation::make('ads')],
]);

Supported Validation Types

  • Spam: Identifies unsolicited, bulk, or irrelevant messages.
  • Nonsense: Flags text that is illogical or meaningless.
  • Botcheck: Detects text likely generated by automated bots.
  • Emoji Overuse: Catches excessive use of emojis in text.
  • Promotional: Highlights promotional or advertising content.
  • Ads: Identifies content that is explicitly advertising.
  • Swearing: Flags use of profanity or offensive language.
  • Hate Speech: Detects speech that promotes hate or discrimination.
  • Political Bias: Identifies politically biased or partisan content.
  • Adult Content: Flags explicit or sexually suggestive content.
  • Secure: Checks for content with potential security risks.
  • Phishing: Identifies attempts to acquire sensitive information.
  • Personal Info: Detects the presence of private personal data.

Support:

naif@naif.io

https://naif.io

Bug Tracker:

https://github.com/naifalshaye/ai-validation/issues/new

License

The MIT License (MIT). Please see License File for more information.