PHP code example of filaforge / filament-chat-ai

1. Go to this page and download the library: Download filaforge/filament-chat-ai library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

filaforge / filament-chat-ai example snippets


use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->plugin(\Filaforge\ChatAi\Providers\ChatAiPanelPlugin::make());
}

// config/chat-ai.php
return [
    'default_provider' => 'openai',
    'providers' => [
        'openai' => [
            'api_key' => env('OPENAI_API_KEY'),
            'model' => 'gpt-4',
        ],
        'anthropic' => [
            'api_key' => env('ANTHROPIC_API_KEY'),
            'model' => 'claude-3-sonnet',
        ],
    ],
];

// remove ->plugin(\Filaforge\ChatAi\Providers\ChatAiPanelPlugin::make())
bash
# Publish provider groups (config, views, migrations)
php artisan vendor:publish --provider="Filaforge\\ChatAi\\Providers\\ChatAiServiceProvider"

# Run migrations
php artisan migrate
bash
php artisan tinker
# Test your API keys manually
bash
php artisan optimize:clear
bash
composer remove filaforge/chat-ai
php artisan optimize:clear