PHPackages                             halilcosdu/laravel-finetuner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. halilcosdu/laravel-finetuner

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

halilcosdu/laravel-finetuner
============================

Laravel Fine tuner is a package designed for the Laravel framework that automates the fine-tuning of OpenAI models. It simplifies the process of adjusting model parameters to optimize performance, tailored specifically for Laravel applications. This tool is ideal for developers looking to enhance AI capabilities in their projects efficiently, with minimal manual intervention.

v1.0.3(2y ago)1846[4 PRs](https://github.com/halilcosdu/laravel-finetuner/pulls)MITPHPPHP ^8.2CI passing

Since Apr 19Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/halilcosdu/laravel-finetuner)[ Packagist](https://packagist.org/packages/halilcosdu/laravel-finetuner)[ Docs](https://github.com/halilcosdu/laravel-finetuner)[ RSS](/packages/halilcosdu-laravel-finetuner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (14)Versions (9)Used By (0)

Laravel Finetuner is a package designed for the Laravel framework that automates the fine-tuning of OpenAI models.
==================================================================================================================

[](#laravel-finetuner-is-a-package-designed-for-the-laravel-framework-that-automates-the-fine-tuning-of-openai-models)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f458dae5100bfe35d0dea8aa7232b5014d07d3937168789dd12b6f48f8a429a6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68616c696c636f7364752f6c61726176656c2d66696e6574756e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/halilcosdu/laravel-finetuner)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4a47f1e8981a81d5f7076d9bbf94237bd5652d1276c69b4406a927c4659c2cab/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616c696c636f7364752f6c61726176656c2d66696e6574756e65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/halilcosdu/laravel-finetuner/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/46eb3304a2e3d311a125e4b0345ebcfb915490bf78b4559e3d03fddf2abf6622/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616c696c636f7364752f6c61726176656c2d66696e6574756e65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/halilcosdu/laravel-finetuner/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/e90765b9706a6634ec4e7f336a81d9b63ccdd58fda04e572a397e499876084ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68616c696c636f7364752f6c61726176656c2d66696e6574756e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/halilcosdu/laravel-finetuner)

It simplifies the process of adjusting model parameters to optimize performance, tailored specifically for Laravel applications. This tool is ideal for developers looking to enhance AI capabilities in their projects efficiently, with minimal manual intervention.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require halilcosdu/laravel-finetuner
```

You can publish the config file with:

```
php artisan vendor:publish --tag="finetuner-config"
```

This is the contents of the published config file:

```
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'),
    ],
```

Usage
-----

[](#usage)

```
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.")
```

```
{
  "training_data": [
    {
      "messages": [
        {
          "role": "system",
          "content": "Given your current situation and needs, how can I assist you today?"
        },
        {
          "role": "user",
          "content": "Hey AI, I've been feeling really stressed out lately because of work. Any advice on how I can manage this better?"
        },
        {
          "role": "assistant",
          "content": "I'm really sorry to hear that you're feeling this way, but please know that it's okay to feel stressed. Here are a few suggestions that might help:\n\n1. Mindfulness and Relaxation: Try techniques like deep breathing, meditation, or yoga. They can help you to stay calm and focused.\n\n2. Time Management: Prioritize your tasks and break them down into manageable chunks. Remember, it's okay to say no to tasks that are not a priority.\n\n3. Physical Activity: Regular exercise can help reduce stress levels. Even a short walk can make a difference.\n\n4. Connect with Others: Talk to someone you trust about your stress. It can often help to share what you're experiencing.\n\n5. Professional Help: If your stress continues or leads to feelings of despair, it might be helpful to speak with a mental health professional.\n\nRemember, everyone experiences stress differently and different techniques work for different people. It's important to find what works best for you."
        }
      ]
    }
  ],
  "file_url": null
}
```

```
// 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')
```

The `php artisan laravel-finetuner` command is used to interact with the Laravel Finetuner package. This command initiates a process that generates examples.

Here's a detailed explanation of how to use this command:

1. Open your terminal.
2. Navigate to your Laravel project directory.
3. Run the command `php artisan laravel-finetuner`.
4. The command will first ask for a `Prompt`. This is a string that will be used to generate examples for fine-tuning. If you don't provide a prompt, it will use a default one.
5. Next, it will ask for the `Temperature`. This is a float value that controls the randomness of the examples generated. A higher value will result in more random examples. If you don't provide a temperature, it will use a default value of `.4`.
6. Then, it will ask for the `Number of examples`. This is an integer that specifies how many examples to generate. If you don't provide a number, it will use a default value of `1`.
7. After you've provided these inputs, the command will ask for your confirmation to continue. If you confirm, it will start generating examples, which may take a while.
8. Once the examples are generated, they will be uploaded. If there's an error during this process, the command will display an error message.
9. If everything goes well, the command will display a URL. This URL points to the location where the generated examples were uploaded.

Remember, this command is part of the Laravel Finetuner package, which is designed to automate the fine-tuning of OpenAI models in Laravel applications.

```
php artisan laravel-finetuner
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Halil Cosdu](https://github.com/halilcosdu)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance52

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

4

Last Release

750d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb33d4d47ce7f6f885331f34e8ed984e57866237d54526a2e3c97bdcbb11ecbb?d=identicon)[halilcosdu](/maintainers/halilcosdu)

---

Top Contributors

[![halilcosdu](https://avatars.githubusercontent.com/u/6373017?v=4)](https://github.com/halilcosdu "halilcosdu (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (13 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")

---

Tags

laravelHalilCosdularavel-finetuner

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/halilcosdu-laravel-finetuner/health.svg)

```
[![Health](https://phpackages.com/badges/halilcosdu-laravel-finetuner/health.svg)](https://phpackages.com/packages/halilcosdu-laravel-finetuner)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
