Skip to content

Commit

Permalink
this will help people get started tons of more docs to come
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Apr 22, 2024
1 parent 0ac4c59 commit 7cce063
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 17 deletions.
Binary file modified .DS_Store
Binary file not shown.
62 changes: 53 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,74 @@
# LaraChain v2
# LaraLamma.ai (LaraChain v2)

![](docs/images/LaraLamma.png)

[![CI-CD](https://github.com/LlmLaraHub/laralamma/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/LlmLaraHub/laralamma/actions/workflows/ci-cd.yml)


This is a major update to LaraChain. Been working on other projects for the past year and going to do what I can to simplify the setup and foundation so anyone can get going embedding, search, and chatting with their data!

This will slowly be broken into modules you can use in your project but for now it is a standalone project that actually is super easy to setup, more on that below.

The core of this is a vector plugin for PostGres to simplify the setup. (no Docker). This setup will focus on Mac but others in Windows can make pull requests as needed to make it work there. Thanks to Laravel HERD this might even be easier with that since it has PostGres as well.

On top of this is Laravel's amazing Batching system to easily allow us to batch up jobs and manage the amount of jobs hit these LLMs at a time and in what order!


## Getting Started

### Embeddings and PostGres
Setup your local environment. I am going to use HERD to start off with. https://herd.laravel.com/
Because their services cost $ (which is well worth it imo) I will link to this to setup PostGres https://postgresapp.com/. Typically I default to DBEngine https://dbngin.com/ but I could not get the vector driver working.

Just install the app like any Laravel App. Copy the .env.example to .env

Make two database is Postgres (use TablePlus https://tableplus.com/ or some other too or cli) callec larachain and one called testing (this is so you do not wipe your database everytime youtest).

You will need this to search your data so make sure after running migrations to do:
>NOTE: Laravel will offer to make the database if it does not exist but not with PostGres yet for me.
Ok then run this in TablePlus:

```sql
CREATE EXTENSION vector;
```

```php
npm install
composer install
```

All set. Now you can migrate some starting data.

```php
php artisan migrate:fresh --seed
```

Now to see it work:

```bash
php artisan horizon:watch
php artisan reverb:start --debug
npm run dev
```

We need Horizon since Batching is key.

## Road Map (still in motion)

You can see a lot of it [here](https://github.com/orgs/LlmLaraHub/projects/1)



## Some links for later
And just thinking how to make some of those flows work in a Laravel environment

[![LaraChain Full Demo](https://img.youtube.com/vi/cz7d6d3pk4o/0.jpg)](https://www.youtube.com/watch?v=cz7d6d3pk4o)
## Videos

[Laravel as a Retrieval Augmented Generator system using OpenAi, Claude and Ollama NO CODE Larachain!](https://www.youtube.com/watch?v=rj5YQLbWF9U&t=8s)

## Articles
[Laravel As A Retrieval Augmented Generator System](https://medium.com/@alnutile/laravel-as-a-retrieval-augmented-generator-system-f3afb64f86aa)

[Local LLM and Laravel in 10 minutes with Local LLM Embedding for free](https://medium.com/@alnutile/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2)



Expand All @@ -31,8 +80,3 @@ Per the Laravel docs https://laravel.com/docs/11.x/reverb

## Local Dev

```bash
php artisan horizon:watch
php artisan reverb:start --debug
npm run dev
```
13 changes: 6 additions & 7 deletions app/Domains/Documents/Transformers/ProcessPpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace App\Domains\Documents\Transformers;

use Faker\Core\File;
use Generator;
use Illuminate\Support\Facades\File as FacadesFile;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
use PhpOffice\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\Shape\Drawing\Gd;
Expand Down Expand Up @@ -40,20 +39,20 @@ public function handle(string $pathToFile): Generator
$guid = $pathToFile.'_'.$page_number;

yield $pageContent;
} elseif($shape instanceof Table) {
} elseif ($shape instanceof Table) {
$table = $shape->getRows();
foreach ($table as $row) {
foreach ($row->getCells() as $cell) {
$pageContent = $cell->getPlainText();
yield $pageContent;
}
}
} elseif($shape instanceof Gd) {
$mimtype = str($shape->getMimeType())->afterLast("/")->toString();
} elseif ($shape instanceof Gd) {
$mimtype = str($shape->getMimeType())->afterLast('/')->toString();
$contents = $shape->getContents();
$name = Str::random(10);
$nameAndType = $name . '.' . $mimtype;
$path = storage_path('app/temp/' . $nameAndType);
$nameAndType = $name.'.'.$mimtype;
$path = storage_path('app/temp/'.$nameAndType);
FacadesFile::put($path, $contents);
}
}
Expand Down
1 change: 0 additions & 1 deletion app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,5 @@ public function boot(): void
return config('llmdriver.drivers.ollama.feature_flags.functions'); //just not ready yet
});


}
}
Binary file modified docs/.DS_Store
Binary file not shown.
Binary file added docs/images/LaraLamma.ai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/LaraLamma.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/.DS_Store
Binary file not shown.

0 comments on commit 7cce063

Please sign in to comment.