PHP code example of filaforge / filament-ollama-chat

1. Go to this page and download the library: Download filaforge/filament-ollama-chat 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-ollama-chat example snippets


use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        // ... other configuration
        ->plugin(\Filaforge\OllamaChat\Filament\OllamaChatPanelPlugin::make());
}

// config/ollama-chat.php
return [
    'base_url' => env('OLLAMA_BASE_URL', 'http://localhost:11434'),
    'default_model' => env('OLLAMA_MODEL', 'llama3'),
    'max_tokens' => env('OLLAMA_MAX_TOKENS', 4096),
    'temperature' => env('OLLAMA_TEMPERATURE', 0.7),
    'stream' => env('OLLAMA_STREAM', true),
    'timeout' => env('OLLAMA_TIMEOUT', 120),
    'system_prompt' => env('OLLAMA_SYSTEM_PROMPT', 'You are a helpful assistant.'),
];

// remove ->plugin(\Filaforge\OllamaChat\Filament\OllamaChatPanelPlugin::make())
bash
# Publish provider groups (config, views, migrations)
php artisan vendor:publish --provider="Filaforge\\OllamaChat\\Providers\\OllamaChatServiceProvider"

# Run migrations
php artisan migrate
bash
php artisan tinker
echo env('OLLAMA_BASE_URL');
bash
php artisan optimize:clear
bash
composer remove filaforge/ollama-chat
php artisan optimize:clear