amostajo/workshop-ai-chatbot

AI chatbox workshop using Laravel + Gemini + Vue 3

★ 0Forks 1PHPGitHub ↗Compare

README

Workshop AI chatbot

This repository implements an AI chatbot using Laravel 12.x + Vue 3.x + Tailwind CSS.

The implementation example is configured so the bot acts as a TCG (Trading card game) expert agent, the latest commited code uses Laravel Ai SDK.

TCG Chatbot sample

AI

Supported AI services:

AI
Gemini

Dev

Environment variables

Aside from built-in Laravel env variables you will need API keys from AI service providers:

Env variable Description
GEMINI_API_KEY Gemini API key.
GEMINI_MODEL Gemini model.

Start Laravel

Use Laravel sail to start your local:

./vendor/bin/sail up -d

Run migrations and seed:

./vendor/bin/sail artisan migrate
./vendor/bin/sail artisan db:seed

Run vite:

npm run dev

Change to WSL on Windows.

wsl

To close docker containers:

./vendor/bin/sail down

Visit the following url to test the chatbot:

http://localhost

Configuration

The file /config/chatbot.php contains varios chat configurations.

AI context

Custom context is being stored in the posts database table (replicating WordPress posts structure), these records can be uploaded to the AI provider as static context files.

The repo comes pre-built with database seeds related to TCG, which can be populated with Laravel's seed command:

./vendor/bin/sail artisan db:migrate

Gemini

Gemini: File search

NOTE: Only available when not using Laravel AI agents.

For Gemini, this context is uploaded as text files and saved into "file search stores", this is great for a small knowledge database, for a larger one you will need to opt for LLMs.

Upload DB context

The following command removes the existing context and uploads a new one.

./vendor/bin/sail artisan app:upload-context gemini
Delete context

NOTE: Only available when not using Laravel AI agents.

The following command deletes all existing context uploaded to Gemini.

./vendor/bin/sail artisan app:delete-context gemini

Contributors

amostajo

Issues