Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Mar 23, 2024
1 parent 46105e4 commit 9fc2c00
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 96 deletions.
105 changes: 10 additions & 95 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,107 +1,22 @@
# Template Laravel Install
# LaraChain v2

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!

## Why

This will get any POC going quickly. It has the features needed for a solid proof of concept.
## Getting Started

![](docs/images/welcome.png)
### Embeddings and PostGres

## What
You will need this to search your data so make sure after running migrations to do:

### Deploy quickly and automatically
Using Github Actions

### Parallel Process and Scale as needed with Horizon Queues

### UI Charts and Dashboard with Interia JS
[https://inertiajs.com](https://inertiajs.com)

and

[https://craftable.pro](https://craftable.pro)

## Charting with Apex Charts

[https://apexcharts.com](https://apexcharts.com)

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

## Team Manamagement and 2FA with JetStream

[https://jetstream.laravel.com/introduction.html](https://jetstream.laravel.com/introduction.html)



## How

### ENV Production
Using the Laravel docs [https://laravel.com/docs/10.x/configuration#encryption](https://laravel.com/docs/10.x/configuration#encryption)


## Local Setup
This is your typical Laravel install [https://laravel.com/docs/10.x/installation](https://laravel.com/docs/10.x/installation)
Since it uses Inertia you need to run `npm install` and then `npm dev` when working.


If you want to seed admin see `database/seeders/AdminSeeder`

```bash
php artisan db:seed --class=AdminSeeder
```sql
CREATE EXTENSION vector;
```

## DataObjects

[https://spatie.be/docs/laravel-data/v4/installation-setup](https://spatie.be/docs/laravel-data/v4/installation-setup)

Great pattern to use for data in and out of Classes to keep your code easy to plug classes together and test.

## Admin Dash
It is using [https://docs.craftable.pro/](https://docs.craftable.pro/)


## System Level info Pulse
`/pulse` you must be an admin user (more on that shortly)

[https://pulse.laravel.com/](https://pulse.laravel.com/)


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

## Queue System Horizon


## Forge on AWS

All of this is in Forge so we do not need to SSH or access the server

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


## Single Branch workflow

There is a lot to say here. I will link you to a few sources of information:

[https://www.youtube.com/watch?v=ASOSEiJCyEM&t=6s](https://www.youtube.com/watch?v=ASOSEiJCyEM&t=6s)

The research that backs a lot of this up:

Books and papers linked in article below
[https://alfrednutile.info/ongoing-links-and-notes-about-devops-transformation-using-the-accelerate-data-and-strategies](https://alfrednutile.info/ongoing-links-and-notes-about-devops-transformation-using-the-accelerate-data-and-strategies)

Older Article that refrerences some good sources
[https://alfrednutile.info/feature-flags-in-laravel](https://alfrednutile.info/feature-flags-in-laravel)


### Feature Flag Library
[https://laravel.com/docs/11.x/pennant](https://laravel.com/docs/11.x/pennant)

And some info on it [https://alfrednutile.info/using-laravel-pennant-in-inertia](https://alfrednutile.info/using-laravel-pennant-in-inertia)

## LLM Integration

This example uses OpenAI but we can use any that we want by just swapping out the client.


## Example Message Model for Chating with LLM
## 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)
34 changes: 34 additions & 0 deletions app/Models/Project.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
* Class Project
*
* @property int $id
* @property string $name
* @property string|null $description
* @property bool $active
* @property int $team_id
* @property \Illuminate\Support\Carbon $created_at
* @property \Illuminate\Support\Carbon $updated_at
*/
class Project extends Model
{
use HasFactory;

protected $guarded = [];

protected $cast = [
'active' => 'boolean',
];

public function team(): BelongsTo
{
return $this->belongsTo(Team::class);
}
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
"php-http/discovery": true,
"wikimedia/composer-merge-plugin": true
}
},
"minimum-stability": "beta",
Expand Down
27 changes: 27 additions & 0 deletions database/factories/ProjectFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Database\Factories;

use App\Models\Team;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Project>
*/
class ProjectFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'name' => $this->faker->sentence,
'description' => $this->faker->paragraph,
'active' => $this->faker->boolean,
'team_id' => Team::factory(),
];
}
}
32 changes: 32 additions & 0 deletions database/migrations/2024_03_23_014409_create_projects_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use App\Models\Team;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('projects', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->longText('description')->nullable();
$table->boolean('active')->default(true);
$table->foreignIdFor(Team::class)->constrained()->cascadeOnDelete();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('projects');
}
};
19 changes: 19 additions & 0 deletions tests/Feature/Models/ProjectTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Tests\Feature\Models;

use Tests\TestCase;

class ProjectTest extends TestCase
{
/**
* A basic feature test example.
*/
public function test_factory(): void
{
$model = \App\Models\Project::factory()->create();

$this->assertNotNull($model->team->id);

}
}

0 comments on commit 9fc2c00

Please sign in to comment.