Skip to content

Kenneth-Inkum/larrykonn

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Larrykonn

Larrykonn is a minimal demo app that showcases what’s possible with the Laravel AI SDK.

Links:

Quickstart

  1. Copy the environment file:
cp .env.example .env
  1. Add at least one AI provider API key in .env.
  2. Install dependencies, generate an app key, migrate, and run the dev server:
composer install
npm install
php artisan key:generate
php artisan migrate
npm run dev

Features (with tiny examples)

Agents (prompt + stream)

use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Promptable;

class DemoAgent implements Agent
{
    use Promptable;

    public function instructions(): string
    {
        return 'You are a concise product guide.';
    }
}

$text = (new DemoAgent)->prompt('Summarize the new release.')->text;
return (new DemoAgent)->stream('Write a short launch blurb.');

Structured output

use Illuminate\Contracts\JsonSchema\JsonSchema;
use Laravel\Ai\Contracts\Agent;
use Laravel\Ai\Contracts\HasStructuredOutput;
use Laravel\Ai\Promptable;

class Reviewer implements Agent, HasStructuredOutput
{
    use Promptable;

    public function instructions(): string
    {
        return 'Review copy and score it.';
    }

    public function schema(JsonSchema $schema): array
    {
        return [
            'score' => $schema->integer()->min(1)->max(10)->required(),
            'feedback' => $schema->string()->required(),
        ];
    }
}

$review = (new Reviewer)->prompt('Review this hero headline.');

Images + audio + transcription

use Laravel\Ai\Audio;
use Laravel\Ai\Image;
use Laravel\Ai\Transcription;

$image = Image::of('A studio photo of a latte')->landscape()->generate();
$audio = Audio::of('Welcome to Larrykonn.')->female()->generate();
$text = Transcription::fromStorage('demo.wav')->generate();

Embeddings + reranking

use Laravel\Ai\Embeddings;
use Laravel\Ai\Reranking;

$vectors = Embeddings::for(['Doc A', 'Doc B'])->dimensions(1536)->generate();
$ranked = Reranking::of(['Doc A', 'Doc B'])->rerank('best match');

Files + vector stores

use Laravel\Ai\Files\Document;
use Laravel\Ai\Stores;

$file = Document::fromStorage('guide.pdf')->put();
$store = Stores::create('Knowledge Base');
$store->add($file->id);

Testing fakes

use Laravel\Ai\Embeddings;
use Laravel\Ai\Image;

Image::fake();
Embeddings::fake()->preventStrayEmbeddings();

About

A personal assistant and RAG service showcasing Laravel AI SDK.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 63.9%
  • PHP 34.4%
  • Other 1.7%