Skip to content

A Cloudflare Workers AI provider for Laravel AI

Cloudflare Workers AI in Laravel, with Clef and Clairic.

Cloudflare Workers AI provider for the Laravel AI SDK: text, embeddings, reranking, images, speech, transcription, Clef decisions and Clairic typed extraction, with AI Gateway routing.

composer require meirdick/laravel-cf-workersai

Answers, not generated text

Clef and Clairic are System One models. They do not generate tokens. They read your input in one pass and return typed answers with probabilities.

Clef decides among options you list.

use Laravel\Ai\Classification;
use Laravel\Ai\Classification\Boolean;

$response = Classification::of($ticket)
    ->question('urgent', new Boolean('Urgent?'))
    ->classify(provider: 'workers-ai');

$response['urgent']->isTrue();
Clef guide

Clairic extracts a value of the type you ask for, or null.

use Meirdick\WorkersAi\Extraction;
use Meirdick\WorkersAi\Extraction\Number;

$invoice = Extraction::of($text)
    ->field('total', new Number(unit: 'USD'))
    ->extract();

$invoice['total']->value();
Clairic guide

Needs PHP 8.3 and laravel/ai 0.9 to 1.3. Clef needs laravel/ai 1.0 or later. MIT license.

Type to search…

↑↓ navigate↵ selectEsc close