1. Go to this page and download the library: Download lmsomeco/laravel-ai-models 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/ */
lmsomeco / laravel-ai-models example snippets
use Laravel\Ai\Enums\Lab;
use LmSomeco\AiModels\Facades\AiModels;
AiModels::all(); // Collection<AiModel>
AiModels::provider(Lab::Anthropic); // accepts a Lab or its string value
AiModels::configuredProviders(); // Collection<int, string> of provider names
AiModels::refresh(); // clear all cached lists
AiModels::refresh(Lab::Groq); // clear one
$model = AiModels::provider(Lab::OpenAI)->firstWhere('id', 'gpt-4o');
$model->provider; // Laravel\Ai\Enums\Lab::OpenAI
$model->id; // 'gpt-4o'
$model->contextWindow; // int|null
$model->modalities; // input modalities; [] when unknown
$model->outputModalities; // output modalities; [] when unknown
$model->raw; // untouched provider payload