Download the PHP package mohammadsalamat/chat_ai without Composer
On this page you can find all versions of the php package mohammadsalamat/chat_ai. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohammadsalamat/chat_ai
More information about mohammadsalamat/chat_ai
Files in mohammadsalamat/chat_ai
Package chat_ai
Short Description The Chat AI Laravel Package is a smart chatbot integration for Laravel applications. It dynamically retrieves responses from multiple sources, prioritizing efficiency and accuracy
License MIT
Informations about the package chat_ai
Chat AI Laravel Package
Overview
The Chat AI Laravel Package is an intelligent chatbot integration for Laravel applications. It retrieves responses dynamically from multiple sources, ensuring accuracy and efficiency:
- Database – Checks for an existing response.
- ChatGPT – If no response is found in the database, it queries OpenAI’s ChatGPT.
- Gemini AI – If ChatGPT reaches its limit, it switches to Google Gemini.
- Google Search – If no AI-generated response is available, it fetches relevant search results.
- Self-Learning – If an answer is not found, it is stored in the database for future queries.
How It Works
The chatbot follows a structured search approach:
-
Database Lookup
- The chatbot first searches the database for a response.
- Admins can manually add a list of questions and answers.
- If the user's question is at least 70% similar (adjustable via the config file) to a stored question, it retrieves the answer.
-
ChatGPT Integration
- If no answer is found in the database, it queries ChatGPT.
- The response is then stored in the database to reduce API usage and allow admin modifications.
-
Fallback to Gemini AI
- If ChatGPT is inactive or has reached its limit, the chatbot switches to Gemini AI and follows the same process.
- Google Search
- If neither ChatGPT nor Gemini AI provides an answer, it fetches relevant data using Google Search.
Provides
- Simple Blade View – A minimal and customizable chat interface.
- Lightweight Controller – A clean structure to handle requests and responses.
- Database Migration – Stores previous queries and responses for improved efficiency.
Features
- Multi-source response system (Database → ChatGPT → Gemini → Google Search).
- Self-learning AI – Stores new questions and answers.
- Efficient fallback mechanism for uninterrupted responses.
- Simple API interface for easy integration.
- Optimized for performance with caching and similarity checks.
Installation
1. Install via Composer
Run the following command to install the package:
2. Publish Configuration (Optional)
This command publishes the migration and view files.
3. Run Migrations
This creates a new database table called questions
to store chatbot interactions.
4. Add API Keys to .env
Obtain API keys for OpenAI, Gemini, and Google Search, then update your .env
file:
Usage
1. Use in a Controller or Route
Dependency Injection Approach
Instantiating the Controller Manually
2. Create a POST Route to Send a Message
3. Frontend Integration
Send an AJAX request to your Laravel endpoint. A custom view is available at resources/views/chat_ai
, including the following AJAX request:
Configuration
The package includes a configuration file located at config/chat_ai.php
, where you can customize settings such as:
- API Limits
- Similarity Threshold
- Caching Options
Contributing
Feel free to submit pull requests or open issues for bug fixes and feature requests.
License
This package is open-source and available under the MIT License.