PHP code example of halilcosdu / laravel-finetuner

1. Go to this page and download the library: Download halilcosdu/laravel-finetuner 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/ */

    

halilcosdu / laravel-finetuner example snippets


return [
    'api_key' => env('OPENAI_API_KEY'),
    'organization' => env('OPENAI_ORGANIZATION'),
    'request_timeout' => env('OPENAI_TIMEOUT'),
    'use_storage' => env('FINE_TUNER_USE_STORAGE', false),
    'sleep_seconds' => env('OPENAI_SLEEP_SECONDS'), //Sleep seconds between requests default .1
    'storage' => [
        'disk' => env('FINE_TUNER_STORAGE', 'public'),
    ],

use HalilCosdu\FineTuner\Facades\FineTuner;

FineTuner::generateExamples($prompt, $temperature = .4, $numberOfExamples = 2): array
FineTuner::upload(string $file): string
FineTuner::fineTune(string $fileId, string $model = 'gpt-3.5-turbo'): string

use HalilCosdu\FineTuner\Facades\FineTuner;

// Generate examples for fine-tuning
$trainingExamples = FineTuner::generateExamples("A versatile AI assistant designed to provide personalized support across all aspects of life, from physical health and mental wellness to emotional well-being, adapting its guidance to the user's unique situation and needs. It offers practical advice, empathetic support, and proactive reminders, all while ensuring privacy and security, and continuously evolving through feedback and research.")



// If the `FINE_TUNER_USE_STORAGE` environment variable is set to `true`, the `file_url` will be returned for the upload function. Alternatively, you can create your own training `.jsonl` file using the `training_data`.

// Upload the training data
$fileId = FineTuner::upload($trainingExamples['file_url'])

// Fine-tune the model
FineTuner::fineTune($fileId, 'gpt-3.5-turbo')

php artisan laravel-finetuner
bash
php artisan vendor:publish --tag="finetuner-config"