From a315b879103c6b046f09e5d9a340542c3a4b91ba Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 08:54:37 -0400 Subject: [PATCH 01/25] ok distance query is fine with meta_data now for functions --- .../app/DistanceQuery/Drivers/Base.php | 2 -- .../app/DistanceQuery/Drivers/Mock.php | 1 - .../app/DistanceQuery/Drivers/PostGres.php | 20 ++++++------- Modules/LlmDriver/app/Orchestrate.php | 2 +- .../tests/Feature/DistanceQueryClientTest.php | 13 +++++++-- app/Domains/Chat/MetaDataDto.php | 12 ++++++++ .../Messages/SearchAndSummarizeChatRepo.php | 28 +++++++++++-------- app/Models/Message.php | 11 ++++++++ resources/js/bootstrap.js | 2 -- tests/Feature/Models/MessageTest.php | 12 ++++++++ .../SearchAndSummarizeChatRepoTest.php | 15 +++++++++- 11 files changed, 87 insertions(+), 31 deletions(-) diff --git a/Modules/LlmDriver/app/DistanceQuery/Drivers/Base.php b/Modules/LlmDriver/app/DistanceQuery/Drivers/Base.php index 430b11d2..a48bf602 100644 --- a/Modules/LlmDriver/app/DistanceQuery/Drivers/Base.php +++ b/Modules/LlmDriver/app/DistanceQuery/Drivers/Base.php @@ -4,7 +4,6 @@ use App\Domains\Chat\MetaDataDto; use App\Models\DocumentChunk; -use App\Models\Filter; use Illuminate\Support\Collection; use Pgvector\Laravel\Vector; @@ -14,7 +13,6 @@ abstract public function cosineDistance( string $embeddingSize, int $collectionId, Vector $embedding, - ?Filter $filter = null, ?MetaDataDto $meta_data = null ): Collection; diff --git a/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php b/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php index 4b86f955..cf644875 100644 --- a/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php +++ b/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php @@ -15,7 +15,6 @@ public function cosineDistance( string $embeddingSize, int $collectionId, Vector $embedding, - ?Filter $filter = null, ?MetaDataDto $meta_data = null ): Collection { $documents = CollectionModel::find($collectionId)->documents->pluck('id'); diff --git a/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php b/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php index 6c41385b..61a65a38 100644 --- a/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php +++ b/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php @@ -18,10 +18,12 @@ public function cosineDistance( string $embeddingSize, int $collectionId, Vector $embedding, - ?Filter $filter = null, ?MetaDataDto $meta_data = null ): Collection { + $filter = $meta_data?->getFilter(); + $date_range = $meta_data?->date_range; + Log::info('[LaraChain] - PostgresSQL Cosine Query', [ 'filter' => $filter?->toArray(), 'embedding_size' => $embeddingSize, @@ -32,16 +34,14 @@ public function cosineDistance( ->when($filter, function ($query, $filter) { $query->whereIn('id', $filter->documents()->pluck('id')); }) - ->when($meta_data, function ($query, $meta_data) { - if ($meta_data->date_range) { - $results = DateRangesEnum::getStartAndEndDates($meta_data->date_range); + ->when($date_range, function ($query, $date_range) { + $results = DateRangesEnum::getStartAndEndDates($date_range); - $query->whereBetween( - 'created_at', [ - $results['start'], - $results['end'], - ]); - } + $query->whereBetween( + 'created_at', [ + $results['start'], + $results['end'], + ]); }) ->where('documents.collection_id', $collectionId) ->orderBy('id') diff --git a/Modules/LlmDriver/app/Orchestrate.php b/Modules/LlmDriver/app/Orchestrate.php index 2fab67b7..f6ccd018 100644 --- a/Modules/LlmDriver/app/Orchestrate.php +++ b/Modules/LlmDriver/app/Orchestrate.php @@ -164,7 +164,7 @@ public function handle( } else { Log::info('[LaraChain] Orchestration No Functions Default Search And Summarize'); - return SearchAndSummarizeChatRepo::search($chat, $message, $filter); + return SearchAndSummarizeChatRepo::search($chat, $message); } } diff --git a/Modules/LlmDriver/tests/Feature/DistanceQueryClientTest.php b/Modules/LlmDriver/tests/Feature/DistanceQueryClientTest.php index 7b87cdc9..0ca5f528 100644 --- a/Modules/LlmDriver/tests/Feature/DistanceQueryClientTest.php +++ b/Modules/LlmDriver/tests/Feature/DistanceQueryClientTest.php @@ -46,6 +46,10 @@ public function test_mock_results() $filter->documents()->attach($document->id); + $meta_data = MetaDataDto::from([ + 'filter' => $filter->id, + ]); + $question = get_fixture('embedding_question_distance.json'); $vector = new Vector($question); @@ -54,7 +58,7 @@ public function test_mock_results() 'embedding_1024', $document->collection_id, $vector, - $filter); + $meta_data); $this->assertCount(1, $results); @@ -126,7 +130,6 @@ public function test_date_range_finds_none() 'embedding_1024', $document->collection_id, $vector, - null, MetaDataDto::from([ 'date_range' => DateRangesEnum::ThisWeek->value, ])); @@ -166,6 +169,10 @@ public function test_results_empty_due_to_filter() $filter->documents()->attach($documentNot->id); + $meta_data = MetaDataDto::from([ + 'filter' => $filter->id, + ]); + $question = get_fixture('embedding_question_distance.json'); $vector = new Vector($question); @@ -174,7 +181,7 @@ public function test_results_empty_due_to_filter() 'embedding_1024', $document->collection_id, $vector, - $filter); + $meta_data); $this->assertCount(0, $results); diff --git a/app/Domains/Chat/MetaDataDto.php b/app/Domains/Chat/MetaDataDto.php index fa869c53..8ffce723 100644 --- a/app/Domains/Chat/MetaDataDto.php +++ b/app/Domains/Chat/MetaDataDto.php @@ -2,6 +2,7 @@ namespace App\Domains\Chat; +use App\Models\Filter; use Spatie\LaravelData\Data; class MetaDataDto extends Data @@ -16,4 +17,15 @@ public function __construct( ) { } + + public function getFilter() : ?Filter + { + $filter = data_get($this, 'filter'); + + if ($filter) { + $filter = Filter::findOrFail($filter); + } + + return $filter; + } } diff --git a/app/Domains/Messages/SearchAndSummarizeChatRepo.php b/app/Domains/Messages/SearchAndSummarizeChatRepo.php index fd4e1f13..8a4ab0f2 100644 --- a/app/Domains/Messages/SearchAndSummarizeChatRepo.php +++ b/app/Domains/Messages/SearchAndSummarizeChatRepo.php @@ -8,6 +8,7 @@ use App\Models\Chat; use App\Models\DocumentChunk; use App\Models\Filter; +use App\Models\Message; use App\Models\PromptHistory; use Facades\App\Domains\Agents\VerifyResponseAgent; use Illuminate\Support\Facades\Log; @@ -24,10 +25,15 @@ class SearchAndSummarizeChatRepo protected string $response = ''; - public function search(Chat $chat, - string $input, - ?Filter $filter = null): string + public function search( + Chat $chat, + Message $message): string { + + $input = $message->body; + + $filter = $message->getFilter(); + Log::info('[LaraChain] Search and Summarize Default Function', [ 'note' => 'Showing input since some system grab the last on the array', 'input' => $input, @@ -35,10 +41,6 @@ public function search(Chat $chat, $originalPrompt = $input; - Log::info('[LaraChain] Embedding the Data', [ - 'question' => $input, - ]); - /** @var EmbeddingsResponseDto $embedding */ $embedding = LlmDriverFacade::driver( $chat->chatable->getEmbeddingDriver() @@ -52,7 +54,7 @@ public function search(Chat $chat, /** @phpstan-ignore-next-line */ $chat->getChatable()->id, $embedding->embedding, - $filter + $message->meta_data ); $content = []; @@ -77,11 +79,12 @@ public function search(Chat $chat, message: $contentFlattened, role: RoleEnum::Assistant, systemPrompt: $chat->chatable->systemPrompt(), - show_in_thread: false + show_in_thread: false, + meta_data: $message->meta_data, ); /** @TODO coming back to chat shorly just moved to completion to focus on prompt */ - $latestMessagesArray = $chat->getChatResponse(); + $latestMessagesArray = $message->getLatestMessages(); Log::info('[LaraChain] Getting the Summary', [ 'input' => $contentFlattened, @@ -106,7 +109,10 @@ public function search(Chat $chat, $this->verify($chat, $originalPrompt, $context); } - $message = $chat->addInput($this->response, RoleEnum::Assistant); + $message = $chat->addInput( + message: $this->response, + role:RoleEnum::Assistant, + meta_data: $message->meta_data); PromptHistory::create([ 'prompt' => $contentFlattened, diff --git a/app/Models/Message.php b/app/Models/Message.php index 3fc559b1..889e0b28 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -95,4 +95,15 @@ public function getLatestMessages(): array { return $this->chat->getChatResponse(); } + + public function getFilter() : ?Filter + { + $filter = data_get($this->meta_data, 'filter'); + + if ($filter) { + $filter = Filter::findOrFail($filter); + } + + return $filter; + } } diff --git a/resources/js/bootstrap.js b/resources/js/bootstrap.js index 4f7d431f..e8d1cd8e 100644 --- a/resources/js/bootstrap.js +++ b/resources/js/bootstrap.js @@ -9,7 +9,6 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; console.log(import.meta.env); if (import.meta.env.VITE_BROADCAST_CONNECTION === 'pusher') { - // Configuration for Pusher window.Echo = new Echo({ broadcaster: 'pusher', key: import.meta.env.VITE_PUSHER_APP_KEY, @@ -17,7 +16,6 @@ if (import.meta.env.VITE_BROADCAST_CONNECTION === 'pusher') { forceTLS: true }); } else { - // Configuration for Reverb window.Echo = new Echo({ broadcaster: 'reverb', key: import.meta.env.VITE_REVERB_APP_KEY, diff --git a/tests/Feature/Models/MessageTest.php b/tests/Feature/Models/MessageTest.php index 7fa9f204..0acb0489 100644 --- a/tests/Feature/Models/MessageTest.php +++ b/tests/Feature/Models/MessageTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature\Models; use App\Domains\Chat\MetaDataDto; +use App\Models\Filter; use App\Models\Message; use Illuminate\Foundation\Testing\RefreshDatabase; use Tests\TestCase; @@ -22,4 +23,15 @@ public function test_factory(): void $this->assertInstanceOf(MetaDataDto::class, $model->meta_data); $this->assertNotNull($model->meta_data->date_range); } + + public function test_get_filter(): void + { + $filter = Filter::factory()->create(); + $model = Message::factory()->create([ + 'meta_data' => MetaDataDto::from([ + 'filter' => $filter->id, + ]), + ]); + $this->assertNotNull($model->getFilter()); + } } diff --git a/tests/Feature/SearchAndSummarizeChatRepoTest.php b/tests/Feature/SearchAndSummarizeChatRepoTest.php index 5df563f1..be940a55 100644 --- a/tests/Feature/SearchAndSummarizeChatRepoTest.php +++ b/tests/Feature/SearchAndSummarizeChatRepoTest.php @@ -3,11 +3,14 @@ namespace Tests\Feature; use App\Domains\Agents\VerifyPromptOutputDto; +use App\Domains\Chat\MetaDataDto; +use App\Domains\Messages\RoleEnum; use App\Domains\Messages\SearchAndSummarizeChatRepo; use App\Models\Chat; use App\Models\Collection; use App\Models\Document; use App\Models\DocumentChunk; +use App\Models\Message; use Facades\App\Domains\Agents\VerifyResponseAgent; use LlmLaraHub\LlmDriver\DistanceQuery\DistanceQueryFacade; use LlmLaraHub\LlmDriver\LlmDriverFacade; @@ -69,7 +72,17 @@ public function test_can_search(): void ->once() ->andReturn(DocumentChunk::all()); - $results = (new SearchAndSummarizeChatRepo())->search($chat, 'Puppy'); + $message = Message::factory()->create([ + 'body' => 'Puppy', + 'role' => RoleEnum::User, + 'is_chat_ignored' => false, + 'chat_id' => $chat->id, + 'meta_data' => MetaDataDto::from([ + 'filter' => null, + ]), + ]); + + $results = (new SearchAndSummarizeChatRepo())->search($chat, $message); $this->assertNotNull($results); $this->assertDatabaseCount('message_document_references', 3); From af20e683b15a879f81b63d967b4c43897a8a092b Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 13:18:00 -0400 Subject: [PATCH 02/25] update function summarize collection --- .../app/Functions/FunctionContract.php | 9 ++-- .../app/Functions/SummarizeCollection.php | 54 +++---------------- app/Models/Message.php | 42 ++++++++++++++- tests/Feature/SummarizeCollectionTest.php | 5 +- 4 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Modules/LlmDriver/app/Functions/FunctionContract.php b/Modules/LlmDriver/app/Functions/FunctionContract.php index 5bb0fc81..a9532fc1 100644 --- a/Modules/LlmDriver/app/Functions/FunctionContract.php +++ b/Modules/LlmDriver/app/Functions/FunctionContract.php @@ -2,6 +2,7 @@ namespace LlmLaraHub\LlmDriver\Functions; +use App\Models\Message; use LlmLaraHub\LlmDriver\HasDrivers; use LlmLaraHub\LlmDriver\Requests\MessageInDto; use LlmLaraHub\LlmDriver\Responses\FunctionResponse; @@ -14,13 +15,9 @@ abstract class FunctionContract protected string $type = 'object'; - /** - * @param MessageInDto[] $messageArray - */ abstract public function handle( - array $messageArray, - HasDrivers $model, - FunctionCallDto $functionCallDto): FunctionResponse; + Message $message, + ): FunctionResponse; public function getFunction(): FunctionDto { diff --git a/Modules/LlmDriver/app/Functions/SummarizeCollection.php b/Modules/LlmDriver/app/Functions/SummarizeCollection.php index 0cd4f648..9ee3bf0a 100644 --- a/Modules/LlmDriver/app/Functions/SummarizeCollection.php +++ b/Modules/LlmDriver/app/Functions/SummarizeCollection.php @@ -4,6 +4,7 @@ use App\Domains\Agents\VerifyPromptInputDto; use App\Domains\Agents\VerifyPromptOutputDto; +use App\Models\Message; use Facades\App\Domains\Agents\VerifyResponseAgent; use Illuminate\Support\Facades\Log; use Laravel\Pennant\Feature; @@ -22,21 +23,17 @@ class SummarizeCollection extends FunctionContract protected string $response = ''; public function handle( - array $messageArray, - HasDrivers $model, - FunctionCallDto $functionCallDto): FunctionResponse + Message $message): FunctionResponse { Log::info('[LaraChain] SummarizeCollection Function called'); - $usersInput = get_latest_user_content($messageArray); - $summary = collect([]); - foreach ($model->getChatable()->documents as $document) { + foreach ($message->getChatable()->documents as $document) { $summary->add($document->summary); } - notify_ui($model->getChat(), 'Getting Summary'); + notify_ui($message->getChat(), 'Getting Summary'); $summary = $summary->implode('\n'); @@ -45,7 +42,7 @@ public function handle( 'token_count_v1' => token_counter($summary), ]); - $prompt = SummarizeCollectionPrompt::prompt($summary, $usersInput); + $prompt = SummarizeCollectionPrompt::prompt($summary, $message->getContent()); $messagesArray = []; @@ -54,18 +51,11 @@ public function handle( 'role' => 'user', ]); - $results = LlmDriverFacade::driver($model->getDriver())->chat($messagesArray); + $results = LlmDriverFacade::driver($message->getDriver())->chat($messagesArray); $this->response = $results->content; - notify_ui($model->getChat(), 'Summary complete'); - - if (Feature::active('verification_prompt')) { - Log::info('[LaraChain] Verifying Summary Collection'); - $this->verify($model, 'Can you summarize this collection of data for me.', $summary); - } - - notify_ui_complete($model->getChat()); + notify_ui($message->getChat(), 'Summary complete'); return FunctionResponse::from([ 'content' => $this->response, @@ -75,36 +65,6 @@ public function handle( ]); } - protected function verify( - HasDrivers $model, - string $originalPrompt, - string $context - ): void { - /** - * Lets Verify - */ - $verifyPrompt = <<<'PROMPT' -This the content from all the documents in this collection. -Then that was passed into the LLM to summarize the results. -PROMPT; - - $dto = VerifyPromptInputDto::from( - [ - 'chattable' => $model->getChat(), - 'originalPrompt' => $originalPrompt, - 'context' => $context, - 'llmResponse' => $this->response, - 'verifyPrompt' => $verifyPrompt, - ] - ); - - notify_ui($model, 'Verifiying Results'); - - /** @var VerifyPromptOutputDto $response */ - $response = VerifyResponseAgent::verify($dto); - - $this->response = $response->response; - } /** * @return PropertyDto[] diff --git a/app/Models/Message.php b/app/Models/Message.php index 889e0b28..d4826110 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -9,8 +9,9 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; +use LlmLaraHub\LlmDriver\HasDrivers; -class Message extends Model +class Message extends Model implements HasDrivers { use HasFactory; @@ -106,4 +107,43 @@ public function getFilter() : ?Filter return $filter; } + + public function getContent() : string { + return $this->body; + } + + public function getDriver(): string + { + return $this->chat->getDriver(); + } + + public function getEmbeddingDriver(): string + { + return $this->chat->getEmbeddingDriver(); + } + + public function getSummary(): string + { + return $this->chat->getSummary(); + } + + public function getId(): int + { + return $this->chat->getId(); + } + + public function getType(): string + { + return $this->chat->getType(); + } + + public function getChatable(): HasDrivers + { + return $this->chat->getChatable(); + } + + public function getChat(): ?Chat + { + return $this->chat; + } } diff --git a/tests/Feature/SummarizeCollectionTest.php b/tests/Feature/SummarizeCollectionTest.php index 9eec5aee..409674b3 100644 --- a/tests/Feature/SummarizeCollectionTest.php +++ b/tests/Feature/SummarizeCollectionTest.php @@ -5,6 +5,7 @@ use App\Domains\Agents\VerifyPromptOutputDto; use App\Models\Collection; use App\Models\DocumentChunk; +use App\Models\Message; use Facades\App\Domains\Agents\VerifyResponseAgent; use LlmLaraHub\LlmDriver\Functions\ParametersDto; use LlmLaraHub\LlmDriver\Functions\PropertyDto; @@ -85,7 +86,9 @@ public function test_gathers_all_content() ]), ]); - $results = (new SummarizeCollection())->handle($messageArray, $chat, $functionCallDto); + $message = Message::factory()->create(); + + $results = (new SummarizeCollection())->handle($message); $this->assertInstanceOf(\LlmLaraHub\LlmDriver\Responses\FunctionResponse::class, $results); From 066a8297c19d3ab23c98ab842ad16d1a90f49b00 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 13:28:06 -0400 Subject: [PATCH 03/25] function StandardsChecker of many --- .../app/Functions/StandardsChecker.php | 32 ++++++------------- .../LlmDriver/app/Requests/MessageInDto.php | 29 ++++++++++++++++- tests/Feature/StandardsCheckerTest.php | 8 ++++- 3 files changed, 45 insertions(+), 24 deletions(-) diff --git a/Modules/LlmDriver/app/Functions/StandardsChecker.php b/Modules/LlmDriver/app/Functions/StandardsChecker.php index 1eb0e50e..6a24a73c 100644 --- a/Modules/LlmDriver/app/Functions/StandardsChecker.php +++ b/Modules/LlmDriver/app/Functions/StandardsChecker.php @@ -3,9 +3,11 @@ namespace LlmLaraHub\LlmDriver\Functions; use App\Domains\Prompts\StandardsCheckerPrompt; +use App\Models\Message; use Illuminate\Support\Facades\Log; use LlmLaraHub\LlmDriver\HasDrivers; use LlmLaraHub\LlmDriver\LlmDriverFacade; +use LlmLaraHub\LlmDriver\Requests\MessageInDto; use LlmLaraHub\LlmDriver\Responses\FunctionResponse; class StandardsChecker extends FunctionContract @@ -20,40 +22,30 @@ class StandardsChecker extends FunctionContract protected array $promptHistory = []; - /** - * @param MessageInDto[] $messageArray - */ public function handle( - array $messageArray, - HasDrivers $model, - FunctionCallDto $functionCallDto): FunctionResponse + Message $message): FunctionResponse { Log::info('[LaraChain] StandardsChecker Function called'); - $usersInput = get_latest_user_content($messageArray); + $usersInput = MessageInDto::fromMessageAsUser($message); - $documents = $model->getChatable()->documents; + $documents = $message->getChatable()->documents; - notify_ui($model->getChat(), 'Going through all the documents to check standards'); + notify_ui($message->getChat(), 'Going through all the documents to check standards'); $this->results = []; foreach ($documents->chunk(3) as $index => $chunk) { try { - notify_ui($model->getChat(), sprintf('About to compare document to %d documents in the Collection', count($chunk))); - $prompts = []; foreach ($chunk as $document) { if ($document->summary) { $prompt = StandardsCheckerPrompt::prompt( - $document->summary, $usersInput - ); - $title = sprintf('Using Document %s as context', $document->subject); - $this->promptHistory[] = StandardsCheckerPrompt::prompt( - $title, $usersInput + $document->summary, $usersInput->content ); + $this->promptHistory[] = $prompt; $prompts[] = $prompt; } else { Log::info('[LaraChain] No Summary for Document', [ @@ -63,11 +55,9 @@ public function handle( } - $results = LlmDriverFacade::driver($model->getDriver()) + $results = LlmDriverFacade::driver($message->getDriver()) ->completionPool($prompts); - notify_ui($model->getChat(), 'Got some results will check the next set of documents in the Collection'); - foreach ($results as $result) { $this->results[] = $result->content; } @@ -79,9 +69,7 @@ public function handle( } } - notify_ui($model->getChat(), 'Wow that was a lot of document!'); - - notify_ui_complete($model->getChat()); + notify_ui($message->getChat(), 'Wow that was a lot of document!'); return FunctionResponse::from([ 'content' => implode('\n', $this->results), diff --git a/Modules/LlmDriver/app/Requests/MessageInDto.php b/Modules/LlmDriver/app/Requests/MessageInDto.php index 1293f606..deabc4c1 100644 --- a/Modules/LlmDriver/app/Requests/MessageInDto.php +++ b/Modules/LlmDriver/app/Requests/MessageInDto.php @@ -3,6 +3,7 @@ namespace LlmLaraHub\LlmDriver\Requests; use App\Domains\Chat\MetaDataDto; +use App\Models\Message; use Spatie\LaravelData\Data; class MessageInDto extends Data @@ -20,7 +21,33 @@ public function toArray(): array { return [ 'content' => $this->content, - 'role' => $this->role, + 'role' => $this->role->value, ]; } + + public static function fromMessageAsUser(Message $message): self + { + return MessageInDto::from( + [ + 'content' => $message->body, + 'role' => $message->role->value, + 'meta_data' => $message->meta_data, + 'is_ai' => false, + 'show' => true, + ] + ); + } + + public static function fromMessageAsAssistant(Message $message): self + { + return MessageInDto::from( + [ + 'content' => $message->body, + 'role' => $message->role->value, + 'meta_data' => $message->meta_data, + 'is_ai' => true, + 'show' => true, + ] + ); + } } diff --git a/tests/Feature/StandardsCheckerTest.php b/tests/Feature/StandardsCheckerTest.php index 8f780ec5..eedda82b 100644 --- a/tests/Feature/StandardsCheckerTest.php +++ b/tests/Feature/StandardsCheckerTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature; use App\Models\Collection; +use App\Models\Message; use LlmLaraHub\LlmDriver\Functions\ParametersDto; use LlmLaraHub\LlmDriver\Functions\PropertyDto; use LlmLaraHub\LlmDriver\Functions\StandardsChecker; @@ -81,7 +82,12 @@ public function test_asks() ]), ]); - $results = (new StandardsChecker())->handle($messageArray, $chat, $functionCallDto); + $message = Message::factory()->create([ + 'chat_id' => $chat->id, + ]); + + $results = (new StandardsChecker()) + ->handle($message); $this->assertInstanceOf(\LlmLaraHub\LlmDriver\Responses\FunctionResponse::class, $results); From 74f719441120b2ddc0e15bbbcf4a6c4b0a72cecf Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 13:28:15 -0400 Subject: [PATCH 04/25] function StandardsChecker of many --- Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php | 1 - Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php | 1 - Modules/LlmDriver/app/Functions/FunctionContract.php | 2 -- Modules/LlmDriver/app/Functions/StandardsChecker.php | 1 - Modules/LlmDriver/app/Functions/SummarizeCollection.php | 6 ------ app/Domains/Chat/MetaDataDto.php | 2 +- app/Domains/Messages/SearchAndSummarizeChatRepo.php | 3 +-- app/Models/Message.php | 5 +++-- 8 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php b/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php index cf644875..165ce195 100644 --- a/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php +++ b/Modules/LlmDriver/app/DistanceQuery/Drivers/Mock.php @@ -5,7 +5,6 @@ use App\Domains\Chat\MetaDataDto; use App\Models\Collection as CollectionModel; use App\Models\DocumentChunk; -use App\Models\Filter; use Illuminate\Support\Collection; use Pgvector\Laravel\Vector; diff --git a/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php b/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php index 61a65a38..0164eb98 100644 --- a/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php +++ b/Modules/LlmDriver/app/DistanceQuery/Drivers/PostGres.php @@ -6,7 +6,6 @@ use App\Domains\Chat\MetaDataDto; use App\Models\Document; use App\Models\DocumentChunk; -use App\Models\Filter; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Pgvector\Laravel\Distance; diff --git a/Modules/LlmDriver/app/Functions/FunctionContract.php b/Modules/LlmDriver/app/Functions/FunctionContract.php index a9532fc1..9bd35e9c 100644 --- a/Modules/LlmDriver/app/Functions/FunctionContract.php +++ b/Modules/LlmDriver/app/Functions/FunctionContract.php @@ -3,8 +3,6 @@ namespace LlmLaraHub\LlmDriver\Functions; use App\Models\Message; -use LlmLaraHub\LlmDriver\HasDrivers; -use LlmLaraHub\LlmDriver\Requests\MessageInDto; use LlmLaraHub\LlmDriver\Responses\FunctionResponse; abstract class FunctionContract diff --git a/Modules/LlmDriver/app/Functions/StandardsChecker.php b/Modules/LlmDriver/app/Functions/StandardsChecker.php index 6a24a73c..5355af2a 100644 --- a/Modules/LlmDriver/app/Functions/StandardsChecker.php +++ b/Modules/LlmDriver/app/Functions/StandardsChecker.php @@ -5,7 +5,6 @@ use App\Domains\Prompts\StandardsCheckerPrompt; use App\Models\Message; use Illuminate\Support\Facades\Log; -use LlmLaraHub\LlmDriver\HasDrivers; use LlmLaraHub\LlmDriver\LlmDriverFacade; use LlmLaraHub\LlmDriver\Requests\MessageInDto; use LlmLaraHub\LlmDriver\Responses\FunctionResponse; diff --git a/Modules/LlmDriver/app/Functions/SummarizeCollection.php b/Modules/LlmDriver/app/Functions/SummarizeCollection.php index 9ee3bf0a..22e62247 100644 --- a/Modules/LlmDriver/app/Functions/SummarizeCollection.php +++ b/Modules/LlmDriver/app/Functions/SummarizeCollection.php @@ -2,13 +2,8 @@ namespace LlmLaraHub\LlmDriver\Functions; -use App\Domains\Agents\VerifyPromptInputDto; -use App\Domains\Agents\VerifyPromptOutputDto; use App\Models\Message; -use Facades\App\Domains\Agents\VerifyResponseAgent; use Illuminate\Support\Facades\Log; -use Laravel\Pennant\Feature; -use LlmLaraHub\LlmDriver\HasDrivers; use LlmLaraHub\LlmDriver\LlmDriverFacade; use LlmLaraHub\LlmDriver\Prompts\SummarizeCollectionPrompt; use LlmLaraHub\LlmDriver\Requests\MessageInDto; @@ -65,7 +60,6 @@ public function handle( ]); } - /** * @return PropertyDto[] */ diff --git a/app/Domains/Chat/MetaDataDto.php b/app/Domains/Chat/MetaDataDto.php index 8ffce723..4f86baeb 100644 --- a/app/Domains/Chat/MetaDataDto.php +++ b/app/Domains/Chat/MetaDataDto.php @@ -18,7 +18,7 @@ public function __construct( } - public function getFilter() : ?Filter + public function getFilter(): ?Filter { $filter = data_get($this, 'filter'); diff --git a/app/Domains/Messages/SearchAndSummarizeChatRepo.php b/app/Domains/Messages/SearchAndSummarizeChatRepo.php index 8a4ab0f2..6d6f44a3 100644 --- a/app/Domains/Messages/SearchAndSummarizeChatRepo.php +++ b/app/Domains/Messages/SearchAndSummarizeChatRepo.php @@ -7,7 +7,6 @@ use App\Domains\Prompts\SummarizePrompt; use App\Models\Chat; use App\Models\DocumentChunk; -use App\Models\Filter; use App\Models\Message; use App\Models\PromptHistory; use Facades\App\Domains\Agents\VerifyResponseAgent; @@ -111,7 +110,7 @@ public function search( $message = $chat->addInput( message: $this->response, - role:RoleEnum::Assistant, + role: RoleEnum::Assistant, meta_data: $message->meta_data); PromptHistory::create([ diff --git a/app/Models/Message.php b/app/Models/Message.php index d4826110..7ca715bd 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -97,7 +97,7 @@ public function getLatestMessages(): array return $this->chat->getChatResponse(); } - public function getFilter() : ?Filter + public function getFilter(): ?Filter { $filter = data_get($this->meta_data, 'filter'); @@ -108,7 +108,8 @@ public function getFilter() : ?Filter return $filter; } - public function getContent() : string { + public function getContent(): string + { return $this->body; } From 75bac54c9d508b6b177cecb01426bfa4c85c4bd8 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 13:39:15 -0400 Subject: [PATCH 05/25] SearchAndSummarize migrated to new pattern --- .../app/Functions/SearchAndSummarize.php | 138 ++++++------------ tests/Feature/Models/ChatTest.php | 1 + tests/Feature/SearchAndSummarizeTest.php | 7 +- 3 files changed, 47 insertions(+), 99 deletions(-) diff --git a/Modules/LlmDriver/app/Functions/SearchAndSummarize.php b/Modules/LlmDriver/app/Functions/SearchAndSummarize.php index 53279a57..1d914941 100644 --- a/Modules/LlmDriver/app/Functions/SearchAndSummarize.php +++ b/Modules/LlmDriver/app/Functions/SearchAndSummarize.php @@ -2,20 +2,15 @@ namespace LlmLaraHub\LlmDriver\Functions; -use App\Domains\Agents\VerifyPromptInputDto; -use App\Domains\Agents\VerifyPromptOutputDto; use App\Domains\Messages\RoleEnum; use App\Domains\Prompts\SummarizePrompt; use App\Models\Chat; +use App\Models\Message; use App\Models\PromptHistory; -use Facades\App\Domains\Agents\VerifyResponseAgent; use Illuminate\Support\Facades\Log; -use Laravel\Pennant\Feature; use LlmLaraHub\LlmDriver\DistanceQuery\DistanceQueryFacade; -use LlmLaraHub\LlmDriver\HasDrivers; use LlmLaraHub\LlmDriver\Helpers\CreateReferencesTrait; use LlmLaraHub\LlmDriver\LlmDriverFacade; -use LlmLaraHub\LlmDriver\Requests\MessageInDto; use LlmLaraHub\LlmDriver\Responses\CompletionResponse; use LlmLaraHub\LlmDriver\Responses\FunctionResponse; @@ -29,14 +24,9 @@ class SearchAndSummarize extends FunctionContract protected string $response = ''; - /** - * @param MessageInDto[] $messageArray - */ public function handle( - array $messageArray, - HasDrivers $model, - FunctionCallDto $functionCallDto - ): FunctionResponse { + Message $message): FunctionResponse + { Log::info('[LaraChain] Using Function: SearchAndSummarize'); /** @@ -47,25 +37,23 @@ public function handle( * @TODO * Should I break up the string using the LLM to make the search better? */ - $input = collect($messageArray)->first(function ($item) { - return $item->role === 'user'; - }); + $input = $message->getContent(); - $originalPrompt = $input->content; + $originalPrompt = $input; $embedding = LlmDriverFacade::driver( - $model->getEmbeddingDriver() + $message->getEmbeddingDriver() )->embedData($originalPrompt); - $embeddingSize = get_embedding_size($model->getEmbeddingDriver()); + $embeddingSize = get_embedding_size($message->getEmbeddingDriver()); - notify_ui($model, 'Searching documents'); + notify_ui($message->getChat(), 'Searching documents'); $documentChunkResults = DistanceQueryFacade::cosineDistance( - $embeddingSize, - $model->getChatable()->id, - $embedding->embedding, - $functionCallDto->filter, + embeddingSize: $embeddingSize, + collectionId: $message->getChatable()->id, + embedding: $embedding->embedding, + meta_data: $message->meta_data, ); $content = []; @@ -87,65 +75,58 @@ public function handle( context: $context ); - $model->getChat()->addInput( + /** + * @TODO @WHY + * Why do I do this system prompt thing? + */ + $message->getChat()->addInput( message: $contentFlattened, role: RoleEnum::Assistant, - systemPrompt: $model->getChat()->getChatable()->systemPrompt(), - show_in_thread: false + systemPrompt: $message->getChat()->getChatable()->systemPrompt(), + show_in_thread: false, + meta_data: $message->meta_data ); Log::info('[LaraChain] Getting the Search and Summary results', [ 'input' => $contentFlattened, - 'driver' => $model->getChat()->getChatable()->getDriver(), + 'driver' => $message->getChat()->getChatable()->getDriver(), ]); - $messageArray = MessageInDto::from([ - 'content' => $contentFlattened, - 'role' => 'user', + notify_ui($message->getChat(), 'Building Summary'); + + /** + * @TODO + * This breaks down here. This was made for a non message / chat + * based chat since non logged in users could use the chat api. + */ + Log::info('[LaraChain] Using the Chat Completion', [ + 'input' => $contentFlattened, + 'driver' => $message->getChatable()->getDriver(), ]); - notify_ui($model, 'Building Summary'); - - if (! get_class($model) === Chat::class) { - Log::info('[LaraChain] Using the Simple Completion', [ - 'input' => $contentFlattened, - 'driver' => $model->getChatable()->getDriver(), - ]); - /** @var CompletionResponse $response */ - $response = LlmDriverFacade::driver( - $model->getChatable()->getDriver() - )->completion($contentFlattened); - } else { - Log::info('[LaraChain] Using the Chat Completion', [ - 'input' => $contentFlattened, - 'driver' => $model->getChatable()->getDriver(), - ]); - $messages = $model->getChat()->getChatResponse(); - - /** @var CompletionResponse $response */ - $response = LlmDriverFacade::driver( - $model->getChatable()->getDriver() - )->chat($messages); - } + $messages = $message->getChat()->getChatResponse(); - $this->response = $response->content; + /** @var CompletionResponse $response */ + $response = LlmDriverFacade::driver( + $message->getChatable()->getDriver() + )->chat($messages); - if (Feature::active('verification_prompt')) { - $this->verify($model, $originalPrompt, $context); - } + $this->response = $response->content; - $message = $model->getChat()->addInput($this->response, RoleEnum::Assistant); + $AssistantMessage = $message->getChat()->addInput($this->response, + RoleEnum::Assistant, + meta_data: $message->meta_data); PromptHistory::create([ 'prompt' => $contentFlattened, - 'chat_id' => $model->getChat()->id, - 'message_id' => $message?->id, - 'collection_id' => $model->getChat()->getChatable()?->id, + 'chat_id' => $message->getChat()->id, + 'message_id' => $AssistantMessage?->id, + 'collection_id' => $message->getChat()->getChatable()?->id, ]); $this->saveDocumentReference($message, $documentChunkResults); - notify_ui_complete($model->getChat()); + notify_ui_complete($message->getChat()); return FunctionResponse::from( [ @@ -156,37 +137,6 @@ public function handle( ); } - protected function verify( - HasDrivers $model, - string $originalPrompt, - string $context - ): void { - /** - * Lets Verify - */ - $verifyPrompt = <<<'PROMPT' -This is the results from a Vector search based on the Users Prompt. -Then that was passed into the LLM to summarize the results. -PROMPT; - - $dto = VerifyPromptInputDto::from( - [ - 'chattable' => $model->getChat(), - 'originalPrompt' => $originalPrompt, - 'context' => $context, - 'llmResponse' => $this->response, - 'verifyPrompt' => $verifyPrompt, - ] - ); - - notify_ui($model, 'Verifiying Results'); - - /** @var VerifyPromptOutputDto $response */ - $response = VerifyResponseAgent::verify($dto); - - $this->response = $response->response; - } - /** * @return PropertyDto[] */ diff --git a/tests/Feature/Models/ChatTest.php b/tests/Feature/Models/ChatTest.php index b4ca62fd..6bf755eb 100644 --- a/tests/Feature/Models/ChatTest.php +++ b/tests/Feature/Models/ChatTest.php @@ -26,6 +26,7 @@ public function test_factory(): void $this->assertNotNull($model->user->id); $this->assertNotNull($model->chatable_id); $this->assertNotNull($model->chatable->id); + $this->assertEquals($collection->id, $model->chatable->id); $this->assertNotNull($model->chatable->systemPrompt()); $this->assertNotNull($collection->chats()->first()->id); } diff --git a/tests/Feature/SearchAndSummarizeTest.php b/tests/Feature/SearchAndSummarizeTest.php index d980575f..d3098778 100644 --- a/tests/Feature/SearchAndSummarizeTest.php +++ b/tests/Feature/SearchAndSummarizeTest.php @@ -115,11 +115,8 @@ public function test_gets_user_input() ] )); - $results = (new SearchAndSummarize())->handle( - messageArray: $messageArray, - model: $chat, - functionCallDto: $functionCallDto - ); + $message = Message::factory()->user()->create(['chat_id' => $chat->id]); + $results = (new SearchAndSummarize())->handle($message); $this->assertNotNull($results); $this->assertDatabaseCount('message_document_references', 3); From a81cb815478440c09a1cb18a2350e71ddf97e9e9 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 13:49:07 -0400 Subject: [PATCH 06/25] Tags not being used and not really a function eg Chat -> Message related --- .../app/Functions/TaggingFunction.php | 83 ---------- .../tests/Feature/TagFunctionTest.php | 156 ------------------ 2 files changed, 239 deletions(-) delete mode 100644 Modules/TagFunction/app/Functions/TaggingFunction.php delete mode 100644 Modules/TagFunction/tests/Feature/TagFunctionTest.php diff --git a/Modules/TagFunction/app/Functions/TaggingFunction.php b/Modules/TagFunction/app/Functions/TaggingFunction.php deleted file mode 100644 index e67090fd..00000000 --- a/Modules/TagFunction/app/Functions/TaggingFunction.php +++ /dev/null @@ -1,83 +0,0 @@ -getSummary(); - - $tags = data_get($functionCallDto->arguments, 'tags', 'no limit'); - - $prompt = << $prompt, - 'role' => 'user', - ]); - - $results = LlmDriverFacade::driver($model->getDriver())->chat($messagesArray); - - $tags = json_decode($results->content, true); - - foreach ($tags as $tag) { - $model->addTag($tag); - } - - return FunctionResponse::from( - [ - 'content' => implode(', ', $tags), - ] - ); - } - - /** - * @return PropertyDto[] - */ - protected function getProperties(): array - { - return [ - new PropertyDto( - name: 'limit_tags', - description: 'This is a comma separated list of tags to limit the results by if needed', - type: 'string', - required: false, - ), - ]; - } -} diff --git a/Modules/TagFunction/tests/Feature/TagFunctionTest.php b/Modules/TagFunction/tests/Feature/TagFunctionTest.php deleted file mode 100644 index 6ded6dbb..00000000 --- a/Modules/TagFunction/tests/Feature/TagFunctionTest.php +++ /dev/null @@ -1,156 +0,0 @@ -chat')->once()->andReturn( - CompletionResponse::from([ - 'content' => $tags, - ]) - ); - $content = <<<'EOT' - 61Accelerate: State of DevOps 2019 | How Do We Improve Productivity? - We wondered if the amount of juggling work would be - significantly different among our highest and lowest - performers—after all, productivity is the ability to get - work done and feel like you are in “a flow.” - To capture this, we asked respondents a few questions: - • How many roles they juggle or different types of - work do they do regardless of their official job title - • How many projects they switched between in a day - • How many projects they were working on overall - - Surprisingly, we did not detect significant differences - between low, medium, high, and elite performers. - Therefore, we cannot conclude that how well teams - develop and deliver software affects the number of - roles and projects that respondents juggle. There is - no such thing as “push through this phase and it will - get significantly better.” Instead, we should take steps - to make our work sustainable. That is done through - process improvement work and automation, which - will reduce toil and make the work repeatable, - consistent, fast, scalable, and auditable. It will - also free us up to do new, creative work. - PRODUCTIVITY, - BURNOUT, AND - JUGGLING WORK - Technical professionals and tools - Our work in 2017 found that empowered teams - who make their own decisions about tools and - implementations contribute to better software - delivery performance. In this year’s research, we - see that given the opportunity, high performers - choose useful and usable tools, and these kinds - of tools improve productivity. - This has important implications for product - design. Products that have both utility and - usability are more likely to be adopted by - technology professionals, and when they are - used, have better outcomes. These kinds of - tools should be prioritized by industry leaders. - It's not enough to deliver products that are - feature complete; they also need to be usable - to be adopted and deliver value during a - DevOps transformation. -EOT; - $documentChunk = DocumentChunk::factory()->create([ - 'content' => $content, - ]); - - $results = (new TaggingFunction())->handle( - [], - $documentChunk, - FunctionCallDto::from([ - 'function_name' => 'tagging_function', - 'arguments' => '[]', - ]) - ); - - $this->assertCount(10, $documentChunk->refresh()->tags); - } - - public function test_use_existing_tags_for_document_level(): void - { - $tags = get_fixture('taggings_results_from_llm.json'); - LlmDriverFacade::shouldReceive('driver->chat')->once()->andReturn( - CompletionResponse::from([ - 'content' => $tags, - ]) - ); - $content = <<<'EOT' - 61Accelerate: State of DevOps 2019 | How Do We Improve Productivity? - We wondered if the amount of juggling work would be - significantly different among our highest and lowest - performers—after all, productivity is the ability to get - work done and feel like you are in “a flow.” - To capture this, we asked respondents a few questions: - • How many roles they juggle or different types of - work do they do regardless of their official job title - • How many projects they switched between in a day - • How many projects they were working on overall - - Surprisingly, we did not detect significant differences - between low, medium, high, and elite performers. - Therefore, we cannot conclude that how well teams - develop and deliver software affects the number of - roles and projects that respondents juggle. There is - no such thing as “push through this phase and it will - get significantly better.” Instead, we should take steps - to make our work sustainable. That is done through - process improvement work and automation, which - will reduce toil and make the work repeatable, - consistent, fast, scalable, and auditable. It will - also free us up to do new, creative work. - PRODUCTIVITY, - BURNOUT, AND - JUGGLING WORK - Technical professionals and tools - Our work in 2017 found that empowered teams - who make their own decisions about tools and - implementations contribute to better software - delivery performance. In this year’s research, we - see that given the opportunity, high performers - choose useful and usable tools, and these kinds - of tools improve productivity. - This has important implications for product - design. Products that have both utility and - usability are more likely to be adopted by - technology professionals, and when they are - used, have better outcomes. These kinds of - tools should be prioritized by industry leaders. - It's not enough to deliver products that are - feature complete; they also need to be usable - to be adopted and deliver value during a - DevOps transformation. -EOT; - $documentChunk = DocumentChunk::factory()->create([ - 'content' => $content, - ]); - - $results = (new TaggingFunction())->handle( - [], - $documentChunk, - FunctionCallDto::from([ - 'function_name' => 'tagging_function', - 'arguments' => '[]', - ]) - ); - - $this->assertCount(10, $documentChunk->refresh()->tags); - } -} From e3dd8ac0d027ee632becc5d806cff02157f5626c Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 14:02:42 -0400 Subject: [PATCH 07/25] ok all the functions are done but I see now I need to do something with the functionsdto :( --- Modules/LlmDriver/app/Orchestrate.php | 12 ++++++------ app/Http/Controllers/ChatController.php | 18 +++++------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/Modules/LlmDriver/app/Orchestrate.php b/Modules/LlmDriver/app/Orchestrate.php index f6ccd018..4154ef93 100644 --- a/Modules/LlmDriver/app/Orchestrate.php +++ b/Modules/LlmDriver/app/Orchestrate.php @@ -111,20 +111,20 @@ public function handle( $arguments = is_array($arguments) ? json_encode($arguments) : ''; - $functionDto = FunctionCallDto::from([ - 'arguments' => $arguments, - 'function_name' => $functionName, - 'filter' => $filter, - ]); /** * @TODO * All functions need to then just get Message * by the time this refactor is done! */ + $functionDto = FunctionCallDto::from([ + 'arguments' => $arguments, + 'function_name' => $functionName, + 'filter' => $filter, + ]); /** @var FunctionResponse $response */ - $response = $functionClass->handle($messagesArray, $chat, $functionDto); + $response = $functionClass->handle($message); Log::info('[LaraChain] - Function Response', [ 'function' => $functionName, diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index 4d994f8e..f949b08a 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -92,19 +92,7 @@ public function chat(Chat $chat) show_in_thread: true, meta_data: $meta_data); - $messagesArray = []; - - $messagesArray[] = MessageInDto::from([ - 'content' => $input, - 'role' => 'user', - 'meta_data' => $meta_data, - ]); - - $filter = data_get($validated, 'filter', null); - - if ($filter) { - $filter = Filter::find($filter); - } + $filter = $message->getFilter(); if ($message->meta_data->tool === 'completion') { Log::info('[LaraChain] Running Simple Completion'); @@ -120,6 +108,10 @@ public function chat(Chat $chat) role: RoleEnum::Assistant, show_in_thread: true); + /** + * @TODO + * MOVE ALL OF THIS BELOW INTO ORCHESTRATE JOB + */ } elseif ($message->meta_data->tool === 'standards_checker') { Log::info('[LaraChain] Running Standards Checker'); notify_ui($chat, 'Running Standards Checker'); From 4358279d4c7e9c90b1c9a2bad4e78882dcbeb18f Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 14:02:49 -0400 Subject: [PATCH 08/25] ok all the functions are done but I see now I need to do something with the functionsdto :( --- Modules/LlmDriver/app/Orchestrate.php | 1 - app/Http/Controllers/ChatController.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/Modules/LlmDriver/app/Orchestrate.php b/Modules/LlmDriver/app/Orchestrate.php index 4154ef93..ca9433b0 100644 --- a/Modules/LlmDriver/app/Orchestrate.php +++ b/Modules/LlmDriver/app/Orchestrate.php @@ -111,7 +111,6 @@ public function handle( $arguments = is_array($arguments) ? json_encode($arguments) : ''; - /** * @TODO * All functions need to then just get Message diff --git a/app/Http/Controllers/ChatController.php b/app/Http/Controllers/ChatController.php index f949b08a..f84799b0 100644 --- a/app/Http/Controllers/ChatController.php +++ b/app/Http/Controllers/ChatController.php @@ -17,13 +17,11 @@ use App\Models\Audience; use App\Models\Chat; use App\Models\Collection; -use App\Models\Filter; use App\Models\Persona; use Illuminate\Bus\Batch; use Illuminate\Support\Facades\Bus; use Illuminate\Support\Facades\Log; use LlmLaraHub\LlmDriver\LlmDriverFacade; -use LlmLaraHub\LlmDriver\Requests\MessageInDto; class ChatController extends Controller { From 081813b07330e5f92e534582730c96610813d455 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 14:42:49 -0400 Subject: [PATCH 09/25] fix tests --- Modules/LlmDriver/app/Orchestrate.php | 3 ++- Modules/LlmDriver/app/Requests/MessageInDto.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Modules/LlmDriver/app/Orchestrate.php b/Modules/LlmDriver/app/Orchestrate.php index ca9433b0..4eee1543 100644 --- a/Modules/LlmDriver/app/Orchestrate.php +++ b/Modules/LlmDriver/app/Orchestrate.php @@ -65,6 +65,7 @@ public function handle( * @TODO * Refactor this since Message really can build this * and I am now passing this into all things. + * Will come back shortly */ $functionDto = FunctionCallDto::from([ 'arguments' => '{}', @@ -72,7 +73,7 @@ public function handle( 'filter' => $filter, ]); - $response = StandardsChecker::handle($messagesArray, $chat, $functionDto); + $response = StandardsChecker::handle($message); $messagesArray = $this->handleResponse($response, $chat); $this->response = $response->content; $this->requiresFollowup = $response->requires_follow_up_prompt; diff --git a/Modules/LlmDriver/app/Requests/MessageInDto.php b/Modules/LlmDriver/app/Requests/MessageInDto.php index deabc4c1..472bebf5 100644 --- a/Modules/LlmDriver/app/Requests/MessageInDto.php +++ b/Modules/LlmDriver/app/Requests/MessageInDto.php @@ -21,7 +21,7 @@ public function toArray(): array { return [ 'content' => $this->content, - 'role' => $this->role->value, + 'role' => $this->role, ]; } From 0a54b95b8499a2b3eccfe6f9583e6920efe489ff Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Thu, 4 Jul 2024 15:15:04 -0400 Subject: [PATCH 10/25] Move functions into the Message model as well --- app/Domains/Chat/ToolsDto.php | 19 +++++++++++++ app/Models/Message.php | 3 ++ database/factories/MessageFactory.php | 10 +++++++ ...024_07_04_190949_add_tools_to_messages.php | 28 +++++++++++++++++++ tests/Feature/Models/MessageTest.php | 5 ++++ 5 files changed, 65 insertions(+) create mode 100644 app/Domains/Chat/ToolsDto.php create mode 100644 database/migrations/2024_07_04_190949_add_tools_to_messages.php diff --git a/app/Domains/Chat/ToolsDto.php b/app/Domains/Chat/ToolsDto.php new file mode 100644 index 00000000..4333fd4c --- /dev/null +++ b/app/Domains/Chat/ToolsDto.php @@ -0,0 +1,19 @@ + RoleEnum::class, + 'tools' => ToolsDto::class, 'meta_data' => MetaDataDto::class, 'in_out' => 'boolean', ]; diff --git a/database/factories/MessageFactory.php b/database/factories/MessageFactory.php index 8a4c1ddd..0420be69 100644 --- a/database/factories/MessageFactory.php +++ b/database/factories/MessageFactory.php @@ -3,9 +3,11 @@ namespace Database\Factories; use App\Domains\Chat\MetaDataDto; +use App\Domains\Chat\ToolsDto; use App\Domains\Messages\RoleEnum; use App\Models\Chat; use Illuminate\Database\Eloquent\Factories\Factory; +use LlmLaraHub\LlmDriver\Functions\FunctionCallDto; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Message> @@ -32,6 +34,14 @@ public function definition(): array 'date_range' => 'this_week', 'input' => 'my input here', ]), + 'tools' => ToolsDto::from([ + 'tools' => [ + FunctionCallDto::from([ + 'arguments' => '{}', + 'function_name' => 'standards_checker', + ]), + ], + ]), ]; } diff --git a/database/migrations/2024_07_04_190949_add_tools_to_messages.php b/database/migrations/2024_07_04_190949_add_tools_to_messages.php new file mode 100644 index 00000000..008d7639 --- /dev/null +++ b/database/migrations/2024_07_04_190949_add_tools_to_messages.php @@ -0,0 +1,28 @@ +json('tools')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('messages', function (Blueprint $table) { + // + }); + } +}; diff --git a/tests/Feature/Models/MessageTest.php b/tests/Feature/Models/MessageTest.php index 0acb0489..af2b1b59 100644 --- a/tests/Feature/Models/MessageTest.php +++ b/tests/Feature/Models/MessageTest.php @@ -3,6 +3,7 @@ namespace Tests\Feature\Models; use App\Domains\Chat\MetaDataDto; +use App\Domains\Chat\ToolsDto; use App\Models\Filter; use App\Models\Message; use Illuminate\Foundation\Testing\RefreshDatabase; @@ -22,6 +23,10 @@ public function test_factory(): void $this->assertNotNull($model->chat->id); $this->assertInstanceOf(MetaDataDto::class, $model->meta_data); $this->assertNotNull($model->meta_data->date_range); + $this->assertNotNull($model->tools); + $this->assertInstanceOf(ToolsDto::class, $model->tools); + + } public function test_get_filter(): void From 85d88232240c25fb6b05aa5c65929133cb06da91 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Fri, 5 Jul 2024 06:43:54 -0400 Subject: [PATCH 11/25] Tons of QA to go --- Modules/LlmDriver/app/ClaudeClient.php | 32 +++++--- Modules/LlmDriver/app/Orchestrate.php | 73 ++++++++++++------- app/Domains/Chat/ToolsDto.php | 4 +- .../MessageDocumentReferenceResource.php | 2 + app/Listeners/AddChatTitleListener.php | 1 - app/Models/Chat.php | 8 +- app/Models/Message.php | 1 - .../Pages/Chat/Components/ReferenceTable.vue | 9 ++- tests/Feature/Models/MessageTest.php | 1 - tests/Feature/OrchestrateTest.php | 4 + tests/fixtures/after_mapping.json | 16 +++- tests/fixtures/before_mapping.json | 39 +++++++--- .../fixtures/claude_client_get_functions.json | 18 +++++ tests/fixtures/latest_messages.json | 44 +++++++++++ 14 files changed, 188 insertions(+), 64 deletions(-) create mode 100644 tests/fixtures/latest_messages.json diff --git a/Modules/LlmDriver/app/ClaudeClient.php b/Modules/LlmDriver/app/ClaudeClient.php index 5af2b80c..18cd1779 100644 --- a/Modules/LlmDriver/app/ClaudeClient.php +++ b/Modules/LlmDriver/app/ClaudeClient.php @@ -37,13 +37,11 @@ public function chat(array $messages): CompletionResponse /** * I need to iterate over each item * then if there are two rows with role assistant I need to insert - * in betwee a user row with some copy to make it work like "And the user search results had" + * in between a user row with some copy to make it work like "And the user search results had" * using the Laravel Collection library */ $messages = $this->remapMessages($messages); - put_fixture('after_mapping.json', $messages); - $results = $this->getClient()->post('/messages', [ 'model' => $model, 'system' => 'Return a markdown response.', @@ -54,12 +52,12 @@ public function chat(array $messages): CompletionResponse if (! $results->ok()) { $error = $results->json()['error']['type']; $message = $results->json()['error']['message']; - put_fixture('claude_error.json', $results->json()); - Log::error('Claude API Error ', [ + Log::error('Claude API Error Chat', [ 'type' => $error, 'message' => $message, ]); - throw new \Exception('Claude API Error '.$message); + + throw new \Exception('Claude API Error Chat'); } $data = null; @@ -93,8 +91,13 @@ public function completion(string $prompt): CompletionResponse if (! $results->ok()) { $error = $results->json()['error']['type']; - Log::error('Claude API Error '.$error); - throw new \Exception('Claude API Error '.$error); + $message = $results->json()['error']['message']; + Log::error('Claude API Error Chat', [ + 'type' => $error, + 'message' => $message, + ]); + + throw new \Exception('Claude API Error Chat'); } $data = null; @@ -201,10 +204,10 @@ protected function getClient() */ public function functionPromptChat(array $messages, array $only = []): array { + $messages = $this->remapMessages($messages); - Log::info('LlmDriver::ClaudeClient::functionPromptChat', $messages); - $functions = $this->getFunctions(); + Log::info('LlmDriver::ClaudeClient::functionPromptChat', $messages); $model = $this->getConfig('claude')['models']['completion_model']; $maxTokens = $this->getConfig('claude')['max_tokens']; @@ -222,11 +225,13 @@ public function functionPromptChat(array $messages, array $only = []): array if (! $results->ok()) { $error = $results->json()['error']['type']; $message = $results->json()['error']['message']; - Log::error('Claude API Error ', [ + + Log::error('Claude API Error getting functions ', [ 'type' => $error, 'message' => $message, ]); - throw new \Exception('Claude API Error '.$message); + + throw new \Exception('Claude API Error getting functions'); } $stop_reason = $results->json()['stop_reason']; @@ -302,6 +307,7 @@ public function getFunctions(): array */ protected function remapMessages(array $messages): array { + put_fixture('before_mapping.json', $messages); $messages = collect($messages)->map(function ($item) { if ($item->role === 'system') { $item->role = 'assistant'; @@ -342,6 +348,8 @@ protected function remapMessages(array $messages): array } + put_fixture('after_mapping.json', $newMessagesArray); + return $newMessagesArray; } diff --git a/Modules/LlmDriver/app/Orchestrate.php b/Modules/LlmDriver/app/Orchestrate.php index 4eee1543..a4c721f4 100644 --- a/Modules/LlmDriver/app/Orchestrate.php +++ b/Modules/LlmDriver/app/Orchestrate.php @@ -2,6 +2,7 @@ namespace LlmLaraHub\LlmDriver; +use App\Domains\Chat\ToolsDto; use App\Domains\Messages\RoleEnum; use App\Models\Chat; use App\Models\Filter; @@ -9,7 +10,6 @@ use App\Models\PromptHistory; use Facades\App\Domains\Messages\SearchAndSummarizeChatRepo; use Facades\LlmLaraHub\LlmDriver\Functions\StandardsChecker; -use Illuminate\Support\Arr; use Illuminate\Support\Facades\Log; use LlmLaraHub\LlmDriver\Functions\FunctionCallDto; use LlmLaraHub\LlmDriver\Helpers\CreateReferencesTrait; @@ -43,10 +43,15 @@ public function handle( * after this refactor */ $messagesArray = $message->getLatestMessages(); + + put_fixture('latest_messages.json', $messagesArray); + $filter = $message->meta_data->filter; + if ($filter) { $filter = Filter::find($filter); } + $tool = $message->meta_data->tool; if ($tool) { @@ -73,11 +78,13 @@ public function handle( 'filter' => $filter, ]); + $this->addToolsToMessage($message, $functionDto); + $response = StandardsChecker::handle($message); - $messagesArray = $this->handleResponse($response, $chat); + $this->handleResponse($response, $chat, $message); $this->response = $response->content; $this->requiresFollowup = $response->requires_follow_up_prompt; - $this->requiresFollowUp($messagesArray, $chat); + $this->requiresFollowUp($message->getLatestMessages(), $chat); } } else { @@ -123,6 +130,8 @@ public function handle( 'filter' => $filter, ]); + $this->addToolsToMessage($message, $functionDto); + /** @var FunctionResponse $response */ $response = $functionClass->handle($message); @@ -137,7 +146,8 @@ public function handle( message: $response->content, role: RoleEnum::Assistant, show_in_thread: true, - meta_data: $message->meta_data); + meta_data: $message->meta_data, + tools: $message->tools); } if ($response->prompt) { @@ -188,40 +198,47 @@ protected function hasFunctions(array $functions): bool /** * @return MessageInDto[] */ - protected function handleResponse(FunctionResponse $response, Chat $chat): array + protected function handleResponse( + FunctionResponse $response, + Chat $chat, + Message $message): void { - $message = null; if ($response->save_to_message) { $message = $chat->addInput( message: $response->content, role: RoleEnum::Assistant, - show_in_thread: true); - } + show_in_thread: true, + meta_data: $message->meta_data, + tools: $message->tools); + + if ($response->prompt) { + PromptHistory::create([ + 'prompt' => $response->prompt, + 'chat_id' => $chat->getChat()->id, + 'message_id' => $message?->id, + /** @phpstan-ignore-next-line */ + 'collection_id' => $chat->getChatable()?->id, + ]); + } - if ($response->prompt) { - PromptHistory::create([ - 'prompt' => $response->prompt, - 'chat_id' => $chat->getChat()->id, - 'message_id' => $message?->id, - /** @phpstan-ignore-next-line */ - 'collection_id' => $chat->getChatable()?->id, - ]); + if (! empty($response->documentChunks)) { + $this->saveDocumentReference( + $message, + $response->documentChunks + ); + } } + } - if (! empty($response->documentChunks)) { - $this->saveDocumentReference( - $message, - $response->documentChunks - ); + protected function addToolsToMessage(Message $message, FunctionCallDto $functionDto): void + { + $tools = $message->tools; + if (! $tools) { + $tools = ToolsDto::from(['tools' => []]); } - - $messagesArray = Arr::wrap(MessageInDto::from([ - 'role' => 'assistant', - 'content' => $response->content, - ])); - - return $messagesArray; + $tools->tools[] = $functionDto; + $message->updateQuietly(['tools' => $tools]); } protected function requiresFollowUp(array $messagesArray, Chat $chat): void diff --git a/app/Domains/Chat/ToolsDto.php b/app/Domains/Chat/ToolsDto.php index 4333fd4c..d2ccce5c 100644 --- a/app/Domains/Chat/ToolsDto.php +++ b/app/Domains/Chat/ToolsDto.php @@ -7,13 +7,11 @@ class ToolsDto extends Data { - /** - * @param FunctionCallDto[] $tools + * @param FunctionCallDto[] $tools */ public function __construct( public array $tools = [] ) { } - } diff --git a/app/Http/Resources/MessageDocumentReferenceResource.php b/app/Http/Resources/MessageDocumentReferenceResource.php index 4bfa67a2..71d452a7 100644 --- a/app/Http/Resources/MessageDocumentReferenceResource.php +++ b/app/Http/Resources/MessageDocumentReferenceResource.php @@ -15,6 +15,7 @@ class MessageDocumentReferenceResource extends JsonResource public function toArray(Request $request): array { $tags = $this->document_chunk?->tags; + if ($tags) { $tags = TagResource::collection($tags); } @@ -28,6 +29,7 @@ public function toArray(Request $request): array 'section_number' => $this->document_chunk?->section_number + 1, //since 0 does not look good in the ui 'summary' => str($this->document_chunk?->content)->markdown(), 'taggings' => $tags, + 'type' => $this->document_chunk?->document->type, ]; } } diff --git a/app/Listeners/AddChatTitleListener.php b/app/Listeners/AddChatTitleListener.php index 7bb85d55..9e2f13a5 100644 --- a/app/Listeners/AddChatTitleListener.php +++ b/app/Listeners/AddChatTitleListener.php @@ -22,6 +22,5 @@ public function __construct() public function handle(MessageCreatedEvent $event): void { TitleRepo::handle($event->message); - notify_ui($event->message->chat, 'Chat Title Updated'); } } diff --git a/app/Models/Chat.php b/app/Models/Chat.php index 0640a973..0351c6a8 100644 --- a/app/Models/Chat.php +++ b/app/Models/Chat.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Domains\Chat\MetaDataDto; +use App\Domains\Chat\ToolsDto; use App\Domains\Messages\RoleEnum; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -87,13 +88,14 @@ public function addInput(string $message, RoleEnum $role = RoleEnum::User, ?string $systemPrompt = null, bool $show_in_thread = true, - ?MetaDataDto $meta_data = null): Message + ?MetaDataDto $meta_data = null, + ?ToolsDto $tools = null): Message { if (! $meta_data) { $meta_data = MetaDataDto::from([]); } - return DB::transaction(function () use ($message, $role, $systemPrompt, $show_in_thread, $meta_data) { + return DB::transaction(function () use ($message, $role, $tools, $systemPrompt, $show_in_thread, $meta_data) { if ($systemPrompt) { $this->createSystemMessageIfNeeded($systemPrompt); @@ -109,6 +111,7 @@ public function addInput(string $message, 'chat_id' => $this->id, 'is_chat_ignored' => ! $show_in_thread, 'meta_data' => $meta_data, + 'tools' => $tools, ]); }); @@ -144,7 +147,6 @@ public function getChatResponse(int $limit = 5): array { $latestMessages = $this->messages() ->orderBy('id', 'desc') - ->limit(5) ->get(); $latestMessagesArray = []; diff --git a/app/Models/Message.php b/app/Models/Message.php index 0c9b7319..71338a18 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; -use LlmLaraHub\LlmDriver\Functions\FunctionCallDto; use LlmLaraHub\LlmDriver\HasDrivers; class Message extends Model implements HasDrivers diff --git a/resources/js/Pages/Chat/Components/ReferenceTable.vue b/resources/js/Pages/Chat/Components/ReferenceTable.vue index 32995155..be29cd63 100644 --- a/resources/js/Pages/Chat/Components/ReferenceTable.vue +++ b/resources/js/Pages/Chat/Components/ReferenceTable.vue @@ -25,7 +25,14 @@ {{ reference.id }} - {{ reference.document_name }} + {{ reference.document_name }} diff --git a/tests/Feature/Models/MessageTest.php b/tests/Feature/Models/MessageTest.php index af2b1b59..02abd413 100644 --- a/tests/Feature/Models/MessageTest.php +++ b/tests/Feature/Models/MessageTest.php @@ -26,7 +26,6 @@ public function test_factory(): void $this->assertNotNull($model->tools); $this->assertInstanceOf(ToolsDto::class, $model->tools); - } public function test_get_filter(): void diff --git a/tests/Feature/OrchestrateTest.php b/tests/Feature/OrchestrateTest.php index 218e5f0e..14eba07b 100644 --- a/tests/Feature/OrchestrateTest.php +++ b/tests/Feature/OrchestrateTest.php @@ -64,6 +64,7 @@ public function test_gets_summarize_function(): void ]); $message = Message::factory()->user()->create([ + 'tools' => [], 'meta_data' => MetaDataDto::from( [ 'tool' => '', @@ -76,7 +77,10 @@ public function test_gets_summarize_function(): void Event::assertDispatched(ChatUiUpdateEvent::class); $this->assertEquals($results, 'This is the summary of the collection'); + $this->assertDatabaseCount('prompt_histories', 1); + + $this->assertCount(1, $message->tools->tools); } public function test_tool_standards_checker(): void diff --git a/tests/fixtures/after_mapping.json b/tests/fixtures/after_mapping.json index 7d46b789..96654c26 100644 --- a/tests/fixtures/after_mapping.json +++ b/tests/fixtures/after_mapping.json @@ -4,7 +4,15 @@ "role": "user" }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```{\"id\":569,\"created_at\":\"2024-07-04T11:19:48.000000Z\",\"updated_at\":\"2024-07-04T11:19:48.000000Z\",\"body\":\"Can you summarize the content for me\",\"chat_id\":83,\"in_out\":true,\"is_chat_ignored\":false,\"role\":\"user\",\"meta_data\":{\"persona\":null,\"filter\":15,\"completion\":false,\"tool\":null,\"date_range\":\"\",\"input\":\"Can you summarize the content for me\"},\"chat\":{\"id\":83,\"created_at\":\"2024-07-04T11:14:06.000000Z\",\"updated_at\":\"2024-07-04T11:16:03.000000Z\",\"chatable_type\":\"App\\\\Models\\\\Collection\",\"chatable_id\":31,\"user_id\":1,\"title\":\"Can you summarize the content for me\"}}```\n\n**Context from the database search of documents for Response**:\n```Ui Updates - Cancel Long Running Jobs, Easier to find Chat Button, Select all docs hav Content Ui Updates - Cancel Long Running Jobs, Easier to find Chat Button, Select all docs hav Select All DocumentsThis can be a big help when you start getting into 50 documents on a page you want to make a Filter on or delete Update SummaryGive it another try as the system will use the Chunks to then redo the summary for the document That Chat Button is Easier to findI have watched tooooo many users try to find the button as I give remote support! Cancel a Long Running Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLlama and Laravel Sail Content LaraLlama and Laravel Sail LaraLlama Meets Laravel SailThanks to Sarthak Shrivastava for taking the time to do this work. LaraLlama now can run using Docker and Sail on your machine. This means that setup will be a breeze thanks to all the work the Laravel team did to make Sail so easy to use with Laravel.Get started now with the docs at https:\/\/docs.larallama.io\/docker.html Posted on: June 22nd, 2024 Share this on social media Facebook Twitter Copyright 2024. LaraLlama Lara Mapping LLM Integration Levels to Levels of Autonomous Driving, it does not have to be all or nothing! Content Mapping LLM Integration Levels to Levels of Autonomous Driving, it does not have to be all or nothing! I thought it would be interesting to compare LLM integration into your day to day business workflows to Levels of Automobile Automation.Here are the levels of Automobile Automation:Level 0 - No Automation: The driver performs all driving tasks.Level 1 - Driver Assistance: The vehicle can assist with either steering or acceleration\/deceleration, but not both s k and preventing the infamous trolling of the system that would lead it to writing about some obscure topic.Three, the system is also taking suggesting based on the stats of the articles read!This level of automation represents a significant leap in AI-assisted content creation and management, though it's important to note that human oversight may still be necessary in some capacity.Wrapping it UpAnd that's how far we can potentially go with automation for our different day to day work tasks. However, it's important to remember that not all business processes are ready for any level of AI inte wever, it's important to remember that not all business processes are ready for any level of AI integration. For instance, tasks like helping a customer get a quote on a new web feature still require a human touch (though this might change in a few years). Similarly, creating engaging videos about innovative ideas for LaraLlama.io remains a primarily human-driven process. (For now )The key takeaway is that LLM integration isn't an all-or-nothing proposition. There's a wide spectrum of possibilities between no automation and full automation. The challengeand opportunitylies in identif ilities between no automation and full automation. The challengeand opportunitylies in identifying which of your daily tasks could benefit from LLM assistance and at what level. Some processes might be ready for Level 4 or 5 automation, while others might be best served by Level 1 or 2 support.As we move forward, it's crucial to approach LLM integration strategically. Start small, experiment with different levels of automation for various tasks, and gradually increase the AI's role as you build confidence in its capabilities.By understanding these different levels of LLM integration, you```", + "content": "Here is a concise summary of the content:\n\nThe article describes how to use LaraLlama, a tool that allows you to embed documents into a local Large Language Model (LLM) in the context of a Laravel web application. Key points:\n\n- LaraLlama enables seamless integration of document embedding capabilities into Laravel projects, allowing you to quickly surface relevant information from your document repository.\n- The article provides a step-by-step guide on setting up and using LaraLlama, including instructions on installing dependencies and configuring the system.\n- By leveraging local LLM embedding, LaraLlama allows efficient search and retrieval of information from documents, without the need for a centralized repository or cloud-based services.\n- This can be useful for organizations that need to quickly surface relevant information from internal documentation, without the overhead or security concerns of external services.\n\nOverall, the article highlights how LaraLlama can be a valuable tool for incorporating powerful document embedding capabilities into Laravel-based applications, enabling more efficient knowledge management and retrieval.", + "role": "assistant" + }, + { + "content": "what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool", + "role": "user" + }, + { + "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool```\n\n**Context from the database search of documents for Response**:\n```LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLlama Standards Checking Tool Content LaraLlama Standards Checking Tool We introduce in this release a Standards Checking tool. Just imagine you have a documentation team and when they write new content in their CMS it can then check the API LaraLlama provides to check it matches the Standards in your Collection. One - Easily choose a persona!Two - Find any of the ones you made in the \"Style Guide\" areaThree - LaraLlama will auto discover the tool to use but this helps for some LLMs like Ollama that do not have tools 100% working yet. Just upload the docume Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log Content Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log For those, like myself, who do not like to watch YouTube videos to learn something new (though I watch a ton of them ) here are the steps to using LaraLamma.ai to easily make an automation that will take GitHub Webhook Events (Pull-Requests, etc) and make a Change-Log.https:\/\/medium.com\/@alnutile\/laravel-rag-3-steps-to-import-commits-summarize-create-a-release-log-8f1d349b6a06The YouTube Video is P```", "role": "assistant" }, { @@ -12,15 +20,15 @@ "content": "Using the surrounding context to continue this response thread" }, { - "content": "**Summary Response**:\n\nThe original query was \"Can you summarize the content for me?\". Based on the provided context, here is a summary:\n\nThe context covers several updates and features for the LaraLlama platform, including:\n\n- Ui updates to make it easier to cancel long-running jobs, find the chat button, and select all documents\n- A new \"Doc Site\" has been released with information about LaraLlama and its use cases\n- An article discussing how LaraLlama, a \"Retrieval Augmented Generation\" (RAG) system, can be integrated into workflows at different levels of automation, similar to the levels of autonomous driving in vehicles.\n\nThe summary highlights the key updates and information provided in the given context, without going into excessive detail. Let me know if you need any clarification or have additional questions!", + "content": "**Response:**\nThe context provided does not directly mention anything about RAG (Retrieval Augmented Generation) systems in relation to LaraLlama. The focus seems to be on how LaraLlama can be used by non-technical business owners to save time in their day-to-day tasks by allowing them to interact with their own data (documents, emails, etc.) through a natural language interface.\n\nSome key points from the context:\n\n- LaraLlama is described as \"more than just a RAG system\", implying it has capabilities beyond a typical RAG system.\n- The focus is on how LaraLlama allows users to \"chat with your own data\" and receive responses grounded in that data, without requiring technical expertise.\n- There are examples of how LaraLlama can be used to automate tasks like generating daily reports from emails, without the need for coding.\n- The overall message is that LaraLlama is designed to be an accessible tool for non-technical business users to leverage the power of language models and document embedding to streamline their work, rather than a technical deep dive into RAG systems.\n\nSo in summary, the context does not provide details about RAG systems specifically, but rather highlights how LaraLlama aims to empower regular business users to interact with their own data more efficiently, without requiring technical skills.", "role": "assistant" }, { - "content": "Can you summarize it but add more details for a newsletter like output \nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool\n\n**IN THE PERSONA OF**\nName of Persona: Alfred Nutile\nExample Content of Persona:\nThese are some bits of text written in my voice\n\nExample:\nWhat this means is that as I work on a new feature or change, it\u2019s already on production even before it is officially \u201cready\u201d. This approach eliminates the stress of release days when staging code is merged into production code. The process is as simple as updating a .env file and running the \u201cphp artisan pennant:purge\u201d command.\n\nExample:\nMany times, companies, managers, and even developers are resistant or hesitant about writing tests, as if they will cause a task to take more time. For years, I have been thinking about how that is \u201cnot true\u201d. But then I realized a bigger point: we all spend time testing the code we write, just some of us use PHPUnit and\/or PEST, while others use other methods like the ones mentioned below.\n\nExample:\nFollowing this post here, I want to show how to use the OpenAi Query Function to query the database. This example will use tags, and the LLM will be tasked with using existing tags to choose 1\u20133 that seem to fit the article. It will then add 1\u20132 more that might be relevant.\n\nExample:\nPython does indeed have plenty of integration tools that make it phenomenal for data handling and machine learning, but PHP can also accomplish a great deal. Furthermore, when PHP is lacking, it can be supplemented with Python through the Process library or a lambda-like function.\n\nExample:\nEven before all the chat systems we now use, the day could quickly have been filled with numerous interruptions. Working in an office with your teammates knocking on your door for small talk while you are working through complex coding logic only to have it all topple over like a house of cards when that person asks, \u201chow was your weekend\u201d or \u201chave you see the show\u2026.\u201d Or \u201cwhat are you working on?\u201d\n\nExample:\nNext time I needed this info, I just wanted to make sure that I have the links I need concerning the Accelerate book and Software Delivery Performance. So I will use this page to continue to add info about these resources.\n** END PERSONA EXAMPLE **", + "content": "How about email ideas", "role": "user" }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```{\"id\":572,\"created_at\":\"2024-07-04T11:23:10.000000Z\",\"updated_at\":\"2024-07-04T11:23:10.000000Z\",\"body\":\"Can you summarize it but add more details for a newsletter like output \\nThese are business owners who want to learn how an LLM can work for them.\\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\\nThey want to understand how normal users can use this tool\\n\\n**IN THE PERSONA OF**\\nName of Persona: Alfred Nutile\\nExample Content of Persona:\\nThese are some bits of text written in my voice\\n\\nExample:\\nWhat this means is that as I work on a new feature or change, it\\u2019s already on production even before it is officially \\u201cready\\u201d. This approach eliminates the stress of release days when staging code is merged into production code. The process is as simple as updating a .env file and running the \\u201cphp artisan pennant:purge\\u201d command.\\n\\nExample:\\nMany times, companies, managers, and even developers are resistant or hesitant about writing tests, as if they will cause a task to take more time. For years, I have been thinking about how that is \\u201cnot true\\u201d. But then I realized a bigger point: we all spend time testing the code we write, just some of us use PHPUnit and\\\/or PEST, while others use other methods like the ones mentioned below.\\n\\nExample:\\nFollowing this post here, I want to show how to use the OpenAi Query Function to query the database. This example will use tags, and the LLM will be tasked with using existing tags to choose 1\\u20133 that seem to fit the article. It will then add 1\\u20132 more that might be relevant.\\n\\nExample:\\nPython does indeed have plenty of integration tools that make it phenomenal for data handling and machine learning, but PHP can also accomplish a great deal. Furthermore, when PHP is lacking, it can be supplemented with Python through the Process library or a lambda-like function.\\n\\nExample:\\nEven before all the chat systems we now use, the day could quickly have been filled with numerous interruptions. Working in an office with your teammates knocking on your door for small talk while you are working through complex coding logic only to have it all topple over like a house of cards when that person asks, \\u201chow was your weekend\\u201d or \\u201chave you see the show\\u2026.\\u201d Or \\u201cwhat are you working on?\\u201d\\n\\nExample:\\nNext time I needed this info, I just wanted to make sure that I have the links I need concerning the Accelerate book and Software Delivery Performance. So I will use this page to continue to add info about these resources.\\n** END PERSONA EXAMPLE **\",\"chat_id\":83,\"in_out\":true,\"is_chat_ignored\":false,\"role\":\"user\",\"meta_data\":{\"persona\":6,\"filter\":15,\"completion\":false,\"tool\":null,\"date_range\":\"\",\"input\":\"Can you summarize it but add more details for a newsletter like output \\nThese are business owners who want to learn how an LLM can work for them.\\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\\nThey want to understand how normal users can use this tool\"},\"chat\":{\"id\":83,\"created_at\":\"2024-07-04T11:14:06.000000Z\",\"updated_at\":\"2024-07-04T11:16:03.000000Z\",\"chatable_type\":\"App\\\\Models\\\\Collection\",\"chatable_id\":31,\"user_id\":1,\"title\":\"Can you summarize the content for me\"}}```\n\n**Context from the database search of documents for Response**:\n```Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Ui Updates - Cancel Long Running Jobs, Easier to find Chat Button, Select all docs hav Content Ui Updates - Cancel Long Running Jobs, Easier to find Chat Button, Select all docs hav Select All DocumentsThis can be a big help when you start getting into 50 documents on a page you want to make a Filter on or delete Update SummaryGive it another try as the system will use the Chunks to then redo the summary for the document That Chat Button is Easier to findI have watched tooooo many users try to find the button as I give remote support! Cancel a Long Running LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLlama and Laravel Sail Content LaraLlama and Laravel Sail LaraLlama Meets Laravel SailThanks to Sarthak Shrivastava for taking the time to do this work. LaraLlama now can run using Docker and Sail on your machine. This means that setup will be a breeze thanks to all the work the Laravel team did to make Sail so easy to use with Laravel.Get started now with the docs at https:\/\/docs.larallama.io\/docker.html Posted on: June 22nd, 2024 Share this on social media Facebook Twitter Copyright 2024. LaraLlama Lara Mapping LLM Integration Levels to Levels of Autonomous Driving, it does not have to be all or nothing! Content Mapping LLM Integration Levels to Levels of Autonomous Driving, it does not have to be all or nothing! I thought it would be interesting to compare LLM integration into your day to day business workflows to Levels of Automobile Automation.Here are the levels of Automobile Automation:Level 0 - No Automation: The driver performs all driving tasks.Level 1 - Driver Assistance: The vehicle can assist with either steering or acceleration\/deceleration, but not both s k and preventing the infamous trolling of the system that would lead it to writing about some obscure topic.Three, the system is also taking suggesting based on the stats of the articles read!This level of automation represents a significant leap in AI-assisted content creation and management, though it's important to note that human oversight may still be necessary in some capacity.Wrapping it UpAnd that's how far we can potentially go with automation for our different day to day work tasks. However, it's important to remember that not all business processes are ready for any level of AI inte wever, it's important to remember that not all business processes are ready for any level of AI integration. For instance, tasks like helping a customer get a quote on a new web feature still require a human touch (though this might change in a few years). Similarly, creating engaging videos about innovative ideas for LaraLlama.io remains a primarily human-driven process. (For now )The key takeaway is that LLM integration isn't an all-or-nothing proposition. There's a wide spectrum of possibilities between no automation and full automation. The challengeand opportunitylies in identif ilities between no automation and full automation. The challengeand opportunitylies in identifying which of your daily tasks could benefit from LLM assistance and at what level. Some processes might be ready for Level 4 or 5 automation, while others might be best served by Level 1 or 2 support.As we move forward, it's crucial to approach LLM integration strategically. Start small, experiment with different levels of automation for various tasks, and gradually increase the AI's role as you build confidence in its capabilities.By understanding these different levels of LLM integration, you```", + "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```How about email ideas```\n\n**Context from the database search of documents for Response**:\n```Automate Email Replies in any Persona Needed Content Automate Email Replies in any Persona Needed Two new features in LaraLlama.io!Personas First, you can now add Personas to the system so you can then have it produce output in that voice. Imagine Marketing content, Customer Feedback etc.Email Reply Automation Then with a few clicks you can point LaraLlama.io to an Email box and have it reply to any of the emails in that box using the Persona (or not). For example you can have a Collection that focuses on HR content or Marketing content or Customer Support Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne```", "role": "assistant" } ] \ No newline at end of file diff --git a/tests/fixtures/before_mapping.json b/tests/fixtures/before_mapping.json index b45a5138..04b438a3 100644 --- a/tests/fixtures/before_mapping.json +++ b/tests/fixtures/before_mapping.json @@ -1,32 +1,51 @@ [ { - "content": "how would I explain this material to someone who is the following:\n\nHCP Safety Focussed Example Content of Persona: MId-Aged HCPs Treating Frail Patients Preferring Safety over Efficacy\n\nFocus is 1 for low 5 for high on the Scale\nTreatment Goals\n\nScale: Relief of Symptoms to Full Remission = 4.5\nEfficacy vs Safety Focus\n\nScale: High Safety to High Efficacy = 1\nPlacement in Adoption Ladder\n\nScale: Laggards 1 to Early Adopters = 4\nKOL Influence\n\nScale: Low 1 to High 5 = 2.5\nChannel Preferences\n\nScale: Traditional - F2F 1 to Digital = 3\nSource of Information\n\nScale: Rep\/MSL 1 to Research Publications = 4.5\nPerceptions on Competitors\n\nScale: Competitor 1 to Pharma Co = 4.5\nSuitability to Patient Types\n\nScale: Frail 1 to Healthy = 1 ** END PERSONA EXAMPLE **", + "content": "Can you summarize the content for me", "role": "user", "is_ai": false, - "show": true + "show": true, + "meta_data": null }, { - "content": "how would I explain this material to someone who is the following:\n\nHCP Safety Focussed Example Content of Persona: MId-Aged HCPs Treating Frail Patients Preferring Safety over Efficacy\n\nFocus is 1 for low 5 for high on the Scale\nTreatment Goals\n\nScale: Relief of Symptoms to Full Remission = 4.5\nEfficacy vs Safety Focus\n\nScale: High Safety to High Efficacy = 1\nPlacement in Adoption Ladder\n\nScale: Laggards 1 to Early Adopters = 4\nKOL Influence\n\nScale: Low 1 to High 5 = 2.5\nChannel Preferences\n\nScale: Traditional - F2F 1 to Digital = 3\nSource of Information\n\nScale: Rep\/MSL 1 to Research Publications = 4.5\nPerceptions on Competitors\n\nScale: Competitor 1 to Pharma Co = 4.5\nSuitability to Patient Types\n\nScale: Frail 1 to Healthy = 1 ** END PERSONA EXAMPLE **", + "content": "Here is a concise summary of the content:\n\nThe article describes how to use LaraLlama, a tool that allows you to embed documents into a local Large Language Model (LLM) in the context of a Laravel web application. Key points:\n\n- LaraLlama enables seamless integration of document embedding capabilities into Laravel projects, allowing you to quickly surface relevant information from your document repository.\n- The article provides a step-by-step guide on setting up and using LaraLlama, including instructions on installing dependencies and configuring the system.\n- By leveraging local LLM embedding, LaraLlama allows efficient search and retrieval of information from documents, without the need for a centralized repository or cloud-based services.\n- This can be useful for organizations that need to quickly surface relevant information from internal documentation, without the overhead or security concerns of external services.\n\nOverall, the article highlights how LaraLlama can be a valuable tool for incorporating powerful document embedding capabilities into Laravel-based applications, enabling more efficient knowledge management and retrieval.", + "role": "assistant", + "is_ai": false, + "show": true, + "meta_data": null + }, + { + "content": "what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool", "role": "user", "is_ai": false, - "show": true + "show": true, + "meta_data": null }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```how would I explain this material to someone who is the following:\n\nHCP Safety Focussed Example Content of Persona: MId-Aged HCPs Treating Frail Patients Preferring Safety over Efficacy\n\nFocus is 1 for low 5 for high on the Scale\nTreatment Goals\n\nScale: Relief of Symptoms to Full Remission = 4.5\nEfficacy vs Safety Focus\n\nScale: High Safety to High Efficacy = 1\nPlacement in Adoption Ladder\n\nScale: Laggards 1 to Early Adopters = 4\nKOL Influence\n\nScale: Low 1 to High 5 = 2.5\nChannel Preferences\n\nScale: Traditional - F2F 1 to Digital = 3\nSource of Information\n\nScale: Rep\/MSL 1 to Research Publications = 4.5\nPerceptions on Competitors\n\nScale: Competitor 1 to Pharma Co = 4.5\nSuitability to Patient Types\n\nScale: Frail 1 to Healthy = 1 ** END PERSONA EXAMPLE **```\n\n**Context from the database search of documents for Response**:\n```Safety\nGuidelines\nSummary:\n\n MHRA Drug Safety Update October 2012, vol 6, issue 3: S1 (http:\/\/www.mhra.gov.uk\/Safetyinformation\/DrugSafetyUpdate\/CON199570)\n NICE Medicines Evidence Commentary 30\" Nov 2012 (www.evidence.nhs.uk) Over the last 8 years there have been several warnings from the MHRA regarding the cardiovascular risks with some non-steroidal anti-inflammatory agents (NSAIDs), specifically diclofenac. Despite this, there continues to be significant prescribing of diclofenac; it accounts for 21% of all NSAID items in the East Midlands. In some areas nearly a third of prescriptions for NSAIDs in primary care are for diclofenac. Ibuprofen and naproxen make up 64% of all NSAID prescriptions in the East Midlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. idlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. Summary:\nMedication \tDosage \tCost (28 days supply)\nIbuprofen 400mg \ttds \t3.36\nNaproxen 500mg \tbd \t4.34\nDiclofenac 50mg \ttds \t2.70\nDiclofenac MR 75mg \tbd \t12.92\nDiclofenac MR 100mg \tdaily \t8.00\nParacetamol 1g \tqds \t6.45\n\nCosts for 28 days supply. Taken from Drug Tariff June 2013. Doses are a guide and do not imply therapeutic equivalence. Recent cohort data have confirmed previous safety warnings that diclofenac has a higher risk of thrombotic events (including Mi and stroke) than naproxen or low-dose ibuprofen. Even a few days of treatment may increase risk, both in healthy individuals and those with cardiovascular disease. High doses of ibuprofen may also have an increased risk. Two meta-analyses have both estimated that, compared with placebo, diclofenac causes around three additional major vascular events per 1000 patients per year, with one such event causing death. Diclofenac continues to be widely prescribed; in s per year, with one such event causing death. Diclofenac continues to be widely prescribed; in some areas of the East Midlands nearly a third of NSAID prescribing is for diclofenac. Ibuprofen (1200mg per day or less) or naproxen (1000mg per day or less) are recommended first-line agents, combined with gastro-protection if at high risk for gastrointestinal adverse events. NSAIDs should be prescribed for the shortest time and lowest dose necessary to control symptoms. In 2005 the European Committee for Medicinal Products for Human Use (CHMP) identified an increased risk of thrombotic events, such as myocardial infarction (MI) or stroke with COX-2 inhibitors. In 2006, they advised that a similar link may exist with non-specific NSAIDs, in particular diclofenac, particularly if used at high doses for long-term treatment. In October 2012, the MHRA confirmed the previous findings, based on a more recent review of the evidence. The currently available data consistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac t sistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac than other widely used non-selective NSAIDs and similar to selective COX-2 inhibitors. Two meta-analyses have both estimated that, compared with placebo, a COX-2 inhibitor or diclofenac causes around three additional major vascular events per 1000 paganie s oyee pattents back event vasula tak. High- 55 Du prorea 2400mg daily) also significantly increased the risk of major coronary events, but its safety requires further study as there were many fewer relevant vascular events. Naproxen did not see Over the last 8 years there have been several warnings from the MHRA regarding the cardiovascular risks with some non-steroidal anti-inflammatory agents (NSAIDs), specifically diclofenac. Despite this, there continues to be significant prescribing of diclofenac; it accounts for 21% of all NSAID items in the East Midlands. In some areas nearly a third of prescriptions for NSAIDs in primary care are for diclofenac. Ibuprofen and naproxen make up 64% of all NSAID prescriptions in the East Midlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. idlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. Recent cohort data have confirmed previous safety warnings that diclofenac has a higher risk of thrombotic events (including Mi and stroke) than naproxen or low-dose ibuprofen. Even a few days of treatment may increase risk, both in healthy individuals and those with cardiovascular disease. High doses of ibuprofen may also have an increased risk. Two meta-analyses have both estimated that, compared with placebo, diclofenac causes around three additional major vascular events per 1000 patients per year, with one such event causing death. Diclofenac continues to be widely prescribed; in s per year, with one such event causing death. Diclofenac continues to be widely prescribed; in some areas of the East Midlands nearly a third of NSAID prescribing is for diclofenac. Ibuprofen (1200mg per day or less) or naproxen (1000mg per day or less) are recommended first-line agents, combined with gastro-protection if at high risk for gastrointestinal adverse events. NSAIDs should be prescribed for the shortest time and lowest dose necessary to control symptoms. In 2005 the European Committee for Medicinal Products for Human Use (CHMP) identified an increased risk of thrombotic events, such as myocardial infarction (MI) or stroke with COX-2 inhibitors. In 2006, they advised that a similar link may exist with non-specific NSAIDs, in particular diclofenac, particularly if used at high doses for long-term treatment. In October 2012, the MHRA confirmed the previous findings, based on a more recent review of the evidence. The currently available data consistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac t sistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac than other widely used non-selective NSAIDs and similar to selective COX-2 inhibitors. Two meta-analyses have both estimated that, compared with placebo, a COX-2 inhibitor or diclofenac causes around three additional major vascular events per 1000 paganie s oyee pattents back event vasula tak. High- 55 Du prorea 2400mg daily) also significantly increased the risk of major coronary events, but its safety requires further study as there were many fewer relevant vascular events. Naproxen did not see afety requires further study as there were many fewer relevant vascular events. Naproxen did not seem to increase the risk of major vascular events. Ibuprofen (1200mg per day or less) and naproxen (1000mg per day or less) are considered to have the most favourable cardiovascular safety profiles of all non-selective NSAIDs. All NSAIDs increased the risk of heart failure and of gastrointestinal (GI) events; naproxen having a higher risk of Gl events than ibuprofen or diclofenac. Results from a Danish cohort study of patients who had suffered a MI suggested that even short-term use of NSAIDs ```\n", + "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool```\n\n**Context from the database search of documents for Response**:\n```LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLlama Standards Checking Tool Content LaraLlama Standards Checking Tool We introduce in this release a Standards Checking tool. Just imagine you have a documentation team and when they write new content in their CMS it can then check the API LaraLlama provides to check it matches the Standards in your Collection. One - Easily choose a persona!Two - Find any of the ones you made in the \"Style Guide\" areaThree - LaraLlama will auto discover the tool to use but this helps for some LLMs like Ollama that do not have tools 100% working yet. Just upload the docume Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log Content Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log For those, like myself, who do not like to watch YouTube videos to learn something new (though I watch a ton of them ) here are the steps to using LaraLamma.ai to easily make an automation that will take GitHub Webhook Events (Pull-Requests, etc) and make a Change-Log.https:\/\/medium.com\/@alnutile\/laravel-rag-3-steps-to-import-commits-summarize-create-a-release-log-8f1d349b6a06The YouTube Video is P```\n", "role": "assistant", "is_ai": false, - "show": true + "show": true, + "meta_data": null }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```how would I explain this material to someone who is the following:\n\nHCP Safety Focussed Example Content of Persona: MId-Aged HCPs Treating Frail Patients Preferring Safety over Efficacy\n\nFocus is 1 for low 5 for high on the Scale\nTreatment Goals\n\nScale: Relief of Symptoms to Full Remission = 4.5\nEfficacy vs Safety Focus\n\nScale: High Safety to High Efficacy = 1\nPlacement in Adoption Ladder\n\nScale: Laggards 1 to Early Adopters = 4\nKOL Influence\n\nScale: Low 1 to High 5 = 2.5\nChannel Preferences\n\nScale: Traditional - F2F 1 to Digital = 3\nSource of Information\n\nScale: Rep\/MSL 1 to Research Publications = 4.5\nPerceptions on Competitors\n\nScale: Competitor 1 to Pharma Co = 4.5\nSuitability to Patient Types\n\nScale: Frail 1 to Healthy = 1 ** END PERSONA EXAMPLE **```\n\n**Context from the database search of documents for Response**:\n```Safety\nGuidelines\nSummary:\n\n MHRA Drug Safety Update October 2012, vol 6, issue 3: S1 (http:\/\/www.mhra.gov.uk\/Safetyinformation\/DrugSafetyUpdate\/CON199570)\n NICE Medicines Evidence Commentary 30\" Nov 2012 (www.evidence.nhs.uk) Over the last 8 years there have been several warnings from the MHRA regarding the cardiovascular risks with some non-steroidal anti-inflammatory agents (NSAIDs), specifically diclofenac. Despite this, there continues to be significant prescribing of diclofenac; it accounts for 21% of all NSAID items in the East Midlands. In some areas nearly a third of prescriptions for NSAIDs in primary care are for diclofenac. Ibuprofen and naproxen make up 64% of all NSAID prescriptions in the East Midlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. idlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. Summary:\nMedication \tDosage \tCost (28 days supply)\nIbuprofen 400mg \ttds \t3.36\nNaproxen 500mg \tbd \t4.34\nDiclofenac 50mg \ttds \t2.70\nDiclofenac MR 75mg \tbd \t12.92\nDiclofenac MR 100mg \tdaily \t8.00\nParacetamol 1g \tqds \t6.45\n\nCosts for 28 days supply. Taken from Drug Tariff June 2013. Doses are a guide and do not imply therapeutic equivalence. Recent cohort data have confirmed previous safety warnings that diclofenac has a higher risk of thrombotic events (including Mi and stroke) than naproxen or low-dose ibuprofen. Even a few days of treatment may increase risk, both in healthy individuals and those with cardiovascular disease. High doses of ibuprofen may also have an increased risk. Two meta-analyses have both estimated that, compared with placebo, diclofenac causes around three additional major vascular events per 1000 patients per year, with one such event causing death. Diclofenac continues to be widely prescribed; in s per year, with one such event causing death. Diclofenac continues to be widely prescribed; in some areas of the East Midlands nearly a third of NSAID prescribing is for diclofenac. Ibuprofen (1200mg per day or less) or naproxen (1000mg per day or less) are recommended first-line agents, combined with gastro-protection if at high risk for gastrointestinal adverse events. NSAIDs should be prescribed for the shortest time and lowest dose necessary to control symptoms. In 2005 the European Committee for Medicinal Products for Human Use (CHMP) identified an increased risk of thrombotic events, such as myocardial infarction (MI) or stroke with COX-2 inhibitors. In 2006, they advised that a similar link may exist with non-specific NSAIDs, in particular diclofenac, particularly if used at high doses for long-term treatment. In October 2012, the MHRA confirmed the previous findings, based on a more recent review of the evidence. The currently available data consistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac t sistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac than other widely used non-selective NSAIDs and similar to selective COX-2 inhibitors. Two meta-analyses have both estimated that, compared with placebo, a COX-2 inhibitor or diclofenac causes around three additional major vascular events per 1000 paganie s oyee pattents back event vasula tak. High- 55 Du prorea 2400mg daily) also significantly increased the risk of major coronary events, but its safety requires further study as there were many fewer relevant vascular events. Naproxen did not see Over the last 8 years there have been several warnings from the MHRA regarding the cardiovascular risks with some non-steroidal anti-inflammatory agents (NSAIDs), specifically diclofenac. Despite this, there continues to be significant prescribing of diclofenac; it accounts for 21% of all NSAID items in the East Midlands. In some areas nearly a third of prescriptions for NSAIDs in primary care are for diclofenac. Ibuprofen and naproxen make up 64% of all NSAID prescriptions in the East Midlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. idlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. Recent cohort data have confirmed previous safety warnings that diclofenac has a higher risk of thrombotic events (including Mi and stroke) than naproxen or low-dose ibuprofen. Even a few days of treatment may increase risk, both in healthy individuals and those with cardiovascular disease. High doses of ibuprofen may also have an increased risk. Two meta-analyses have both estimated that, compared with placebo, diclofenac causes around three additional major vascular events per 1000 patients per year, with one such event causing death. Diclofenac continues to be widely prescribed; in s per year, with one such event causing death. Diclofenac continues to be widely prescribed; in some areas of the East Midlands nearly a third of NSAID prescribing is for diclofenac. Ibuprofen (1200mg per day or less) or naproxen (1000mg per day or less) are recommended first-line agents, combined with gastro-protection if at high risk for gastrointestinal adverse events. NSAIDs should be prescribed for the shortest time and lowest dose necessary to control symptoms. In 2005 the European Committee for Medicinal Products for Human Use (CHMP) identified an increased risk of thrombotic events, such as myocardial infarction (MI) or stroke with COX-2 inhibitors. In 2006, they advised that a similar link may exist with non-specific NSAIDs, in particular diclofenac, particularly if used at high doses for long-term treatment. In October 2012, the MHRA confirmed the previous findings, based on a more recent review of the evidence. The currently available data consistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac t sistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac than other widely used non-selective NSAIDs and similar to selective COX-2 inhibitors. Two meta-analyses have both estimated that, compared with placebo, a COX-2 inhibitor or diclofenac causes around three additional major vascular events per 1000 paganie s oyee pattents back event vasula tak. High- 55 Du prorea 2400mg daily) also significantly increased the risk of major coronary events, but its safety requires further study as there were many fewer relevant vascular events. Naproxen did not see afety requires further study as there were many fewer relevant vascular events. Naproxen did not seem to increase the risk of major vascular events. Ibuprofen (1200mg per day or less) and naproxen (1000mg per day or less) are considered to have the most favourable cardiovascular safety profiles of all non-selective NSAIDs. All NSAIDs increased the risk of heart failure and of gastrointestinal (GI) events; naproxen having a higher risk of Gl events than ibuprofen or diclofenac. Results from a Danish cohort study of patients who had suffered a MI suggested that even short-term use of NSAIDs ```\n", + "content": "\n\n**Response:**\nThe context provided does not directly mention anything about RAG (Retrieval Augmented Generation) systems in relation to LaraLlama. The focus seems to be on how LaraLlama can be used by non-technical business owners to save time in their day-to-day tasks by allowing them to interact with their own data (documents, emails, etc.) through a natural language interface.\n\nSome key points from the context:\n\n- LaraLlama is described as \"more than just a RAG system\", implying it has capabilities beyond a typical RAG system.\n- The focus is on how LaraLlama allows users to \"chat with your own data\" and receive responses grounded in that data, without requiring technical expertise.\n- There are examples of how LaraLlama can be used to automate tasks like generating daily reports from emails, without the need for coding.\n- The overall message is that LaraLlama is designed to be an accessible tool for non-technical business users to leverage the power of language models and document embedding to streamline their work, rather than a technical deep dive into RAG systems.\n\nSo in summary, the context does not provide details about RAG systems specifically, but rather highlights how LaraLlama aims to empower regular business users to interact with their own data more efficiently, without requiring technical skills.", "role": "assistant", "is_ai": false, - "show": true + "show": true, + "meta_data": null + }, + { + "content": "How about email ideas", + "role": "user", + "is_ai": false, + "show": true, + "meta_data": null }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```how would I explain this material to someone who is the following:\n\nHCP Safety Focussed Example Content of Persona: MId-Aged HCPs Treating Frail Patients Preferring Safety over Efficacy\n\nFocus is 1 for low 5 for high on the Scale\nTreatment Goals\n\nScale: Relief of Symptoms to Full Remission = 4.5\nEfficacy vs Safety Focus\n\nScale: High Safety to High Efficacy = 1\nPlacement in Adoption Ladder\n\nScale: Laggards 1 to Early Adopters = 4\nKOL Influence\n\nScale: Low 1 to High 5 = 2.5\nChannel Preferences\n\nScale: Traditional - F2F 1 to Digital = 3\nSource of Information\n\nScale: Rep\/MSL 1 to Research Publications = 4.5\nPerceptions on Competitors\n\nScale: Competitor 1 to Pharma Co = 4.5\nSuitability to Patient Types\n\nScale: Frail 1 to Healthy = 1 ** END PERSONA EXAMPLE **```\n\n**Context from the database search of documents for Response**:\n```Safety\nGuidelines\nSummary:\n\n MHRA Drug Safety Update October 2012, vol 6, issue 3: S1 (http:\/\/www.mhra.gov.uk\/Safetyinformation\/DrugSafetyUpdate\/CON199570)\n NICE Medicines Evidence Commentary 30\" Nov 2012 (www.evidence.nhs.uk) Over the last 8 years there have been several warnings from the MHRA regarding the cardiovascular risks with some non-steroidal anti-inflammatory agents (NSAIDs), specifically diclofenac. Despite this, there continues to be significant prescribing of diclofenac; it accounts for 21% of all NSAID items in the East Midlands. In some areas nearly a third of prescriptions for NSAIDs in primary care are for diclofenac. Ibuprofen and naproxen make up 64% of all NSAID prescriptions in the East Midlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. idlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. Summary:\nMedication \tDosage \tCost (28 days supply)\nIbuprofen 400mg \ttds \t3.36\nNaproxen 500mg \tbd \t4.34\nDiclofenac 50mg \ttds \t2.70\nDiclofenac MR 75mg \tbd \t12.92\nDiclofenac MR 100mg \tdaily \t8.00\nParacetamol 1g \tqds \t6.45\n\nCosts for 28 days supply. Taken from Drug Tariff June 2013. Doses are a guide and do not imply therapeutic equivalence. Recent cohort data have confirmed previous safety warnings that diclofenac has a higher risk of thrombotic events (including Mi and stroke) than naproxen or low-dose ibuprofen. Even a few days of treatment may increase risk, both in healthy individuals and those with cardiovascular disease. High doses of ibuprofen may also have an increased risk. Two meta-analyses have both estimated that, compared with placebo, diclofenac causes around three additional major vascular events per 1000 patients per year, with one such event causing death. Diclofenac continues to be widely prescribed; in s per year, with one such event causing death. Diclofenac continues to be widely prescribed; in some areas of the East Midlands nearly a third of NSAID prescribing is for diclofenac. Ibuprofen (1200mg per day or less) or naproxen (1000mg per day or less) are recommended first-line agents, combined with gastro-protection if at high risk for gastrointestinal adverse events. NSAIDs should be prescribed for the shortest time and lowest dose necessary to control symptoms. In 2005 the European Committee for Medicinal Products for Human Use (CHMP) identified an increased risk of thrombotic events, such as myocardial infarction (MI) or stroke with COX-2 inhibitors. In 2006, they advised that a similar link may exist with non-specific NSAIDs, in particular diclofenac, particularly if used at high doses for long-term treatment. In October 2012, the MHRA confirmed the previous findings, based on a more recent review of the evidence. The currently available data consistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac t sistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac than other widely used non-selective NSAIDs and similar to selective COX-2 inhibitors. Two meta-analyses have both estimated that, compared with placebo, a COX-2 inhibitor or diclofenac causes around three additional major vascular events per 1000 paganie s oyee pattents back event vasula tak. High- 55 Du prorea 2400mg daily) also significantly increased the risk of major coronary events, but its safety requires further study as there were many fewer relevant vascular events. Naproxen did not see Over the last 8 years there have been several warnings from the MHRA regarding the cardiovascular risks with some non-steroidal anti-inflammatory agents (NSAIDs), specifically diclofenac. Despite this, there continues to be significant prescribing of diclofenac; it accounts for 21% of all NSAID items in the East Midlands. In some areas nearly a third of prescriptions for NSAIDs in primary care are for diclofenac. Ibuprofen and naproxen make up 64% of all NSAID prescriptions in the East Midlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. idlands. However, in some areas only half of all NSAID prescriptions are for these preferred agents. Recent cohort data have confirmed previous safety warnings that diclofenac has a higher risk of thrombotic events (including Mi and stroke) than naproxen or low-dose ibuprofen. Even a few days of treatment may increase risk, both in healthy individuals and those with cardiovascular disease. High doses of ibuprofen may also have an increased risk. Two meta-analyses have both estimated that, compared with placebo, diclofenac causes around three additional major vascular events per 1000 patients per year, with one such event causing death. Diclofenac continues to be widely prescribed; in s per year, with one such event causing death. Diclofenac continues to be widely prescribed; in some areas of the East Midlands nearly a third of NSAID prescribing is for diclofenac. Ibuprofen (1200mg per day or less) or naproxen (1000mg per day or less) are recommended first-line agents, combined with gastro-protection if at high risk for gastrointestinal adverse events. NSAIDs should be prescribed for the shortest time and lowest dose necessary to control symptoms. In 2005 the European Committee for Medicinal Products for Human Use (CHMP) identified an increased risk of thrombotic events, such as myocardial infarction (MI) or stroke with COX-2 inhibitors. In 2006, they advised that a similar link may exist with non-specific NSAIDs, in particular diclofenac, particularly if used at high doses for long-term treatment. In October 2012, the MHRA confirmed the previous findings, based on a more recent review of the evidence. The currently available data consistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac t sistently indicate that the risk of Mi, stroke or other thrombotic events is higher for diclofenac than other widely used non-selective NSAIDs and similar to selective COX-2 inhibitors. Two meta-analyses have both estimated that, compared with placebo, a COX-2 inhibitor or diclofenac causes around three additional major vascular events per 1000 paganie s oyee pattents back event vasula tak. High- 55 Du prorea 2400mg daily) also significantly increased the risk of major coronary events, but its safety requires further study as there were many fewer relevant vascular events. Naproxen did not see afety requires further study as there were many fewer relevant vascular events. Naproxen did not seem to increase the risk of major vascular events. Ibuprofen (1200mg per day or less) and naproxen (1000mg per day or less) are considered to have the most favourable cardiovascular safety profiles of all non-selective NSAIDs. All NSAIDs increased the risk of heart failure and of gastrointestinal (GI) events; naproxen having a higher risk of Gl events than ibuprofen or diclofenac. Results from a Danish cohort study of patients who had suffered a MI suggested that even short-term use of NSAIDs ```\n", + "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```How about email ideas```\n\n**Context from the database search of documents for Response**:\n```Automate Email Replies in any Persona Needed Content Automate Email Replies in any Persona Needed Two new features in LaraLlama.io!Personas First, you can now add Personas to the system so you can then have it produce output in that voice. Imagine Marketing content, Customer Feedback etc.Email Reply Automation Then with a few clicks you can point LaraLlama.io to an Email box and have it reply to any of the emails in that box using the Persona (or not). For example you can have a Collection that focuses on HR content or Marketing content or Customer Support Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne```\n", "role": "assistant", "is_ai": false, - "show": true + "show": true, + "meta_data": null } ] \ No newline at end of file diff --git a/tests/fixtures/claude_client_get_functions.json b/tests/fixtures/claude_client_get_functions.json index c319adb5..2eb842f8 100644 --- a/tests/fixtures/claude_client_get_functions.json +++ b/tests/fixtures/claude_client_get_functions.json @@ -32,5 +32,23 @@ }, "required": [] } + }, + { + "name": "standards_checker", + "description": "Checks the prompt data follows the standards of the documents in the collection", + "input_schema": { + "type": "object", + "properties": { + "prompt": { + "description": "The prompt the user is using to check standards.", + "type": "string", + "enum": [], + "default": "" + } + }, + "required": [ + "prompt" + ] + } } ] \ No newline at end of file diff --git a/tests/fixtures/latest_messages.json b/tests/fixtures/latest_messages.json new file mode 100644 index 00000000..847e8c15 --- /dev/null +++ b/tests/fixtures/latest_messages.json @@ -0,0 +1,44 @@ +[ + { + "content": "Can you summarize the content for me", + "role": "user", + "is_ai": false, + "show": true, + "meta_data": null + }, + { + "content": "Here is a concise summary of the content:\n\nThe article describes how to use LaraLlama, a tool that allows you to embed documents into a local Large Language Model (LLM) in the context of a Laravel web application. Key points:\n\n- LaraLlama enables seamless integration of document embedding capabilities into Laravel projects, allowing you to quickly surface relevant information from your document repository.\n- The article provides a step-by-step guide on setting up and using LaraLlama, including instructions on installing dependencies and configuring the system.\n- By leveraging local LLM embedding, LaraLlama allows efficient search and retrieval of information from documents, without the need for a centralized repository or cloud-based services.\n- This can be useful for organizations that need to quickly surface relevant information from internal documentation, without the overhead or security concerns of external services.\n\nOverall, the article highlights how LaraLlama can be a valuable tool for incorporating powerful document embedding capabilities into Laravel-based applications, enabling more efficient knowledge management and retrieval.", + "role": "assistant", + "is_ai": false, + "show": true, + "meta_data": null + }, + { + "content": "what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool", + "role": "user", + "is_ai": false, + "show": true, + "meta_data": null + }, + { + "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool```\n\n**Context from the database search of documents for Response**:\n```LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLlama Standards Checking Tool Content LaraLlama Standards Checking Tool We introduce in this release a Standards Checking tool. Just imagine you have a documentation team and when they write new content in their CMS it can then check the API LaraLlama provides to check it matches the Standards in your Collection. One - Easily choose a persona!Two - Find any of the ones you made in the \"Style Guide\" areaThree - LaraLlama will auto discover the tool to use but this helps for some LLMs like Ollama that do not have tools 100% working yet. Just upload the docume Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log Content Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log For those, like myself, who do not like to watch YouTube videos to learn something new (though I watch a ton of them ) here are the steps to using LaraLamma.ai to easily make an automation that will take GitHub Webhook Events (Pull-Requests, etc) and make a Change-Log.https:\/\/medium.com\/@alnutile\/laravel-rag-3-steps-to-import-commits-summarize-create-a-release-log-8f1d349b6a06The YouTube Video is P```\n", + "role": "assistant", + "is_ai": false, + "show": true, + "meta_data": null + }, + { + "content": "\n\n**Response:**\nThe context provided does not directly mention anything about RAG (Retrieval Augmented Generation) systems in relation to LaraLlama. The focus seems to be on how LaraLlama can be used by non-technical business owners to save time in their day-to-day tasks by allowing them to interact with their own data (documents, emails, etc.) through a natural language interface.\n\nSome key points from the context:\n\n- LaraLlama is described as \"more than just a RAG system\", implying it has capabilities beyond a typical RAG system.\n- The focus is on how LaraLlama allows users to \"chat with your own data\" and receive responses grounded in that data, without requiring technical expertise.\n- There are examples of how LaraLlama can be used to automate tasks like generating daily reports from emails, without the need for coding.\n- The overall message is that LaraLlama is designed to be an accessible tool for non-technical business users to leverage the power of language models and document embedding to streamline their work, rather than a technical deep dive into RAG systems.\n\nSo in summary, the context does not provide details about RAG systems specifically, but rather highlights how LaraLlama aims to empower regular business users to interact with their own data more efficiently, without requiring technical skills.", + "role": "assistant", + "is_ai": false, + "show": true, + "meta_data": null + }, + { + "content": "How about email ideas", + "role": "user", + "is_ai": false, + "show": true, + "meta_data": null + } +] \ No newline at end of file From c17d600d3f24d1f999b835fb6a30ca52d6289aa6 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Fri, 5 Jul 2024 13:26:02 -0400 Subject: [PATCH 12/25] claude has a funny issue if you do not sandwhich a functions request in user based roles --- Modules/LlmDriver/app/ClaudeClient.php | 22 ++++++++++-- .../tests/Feature/ClaudeClientTest.php | 16 +++++++++ database/factories/SettingFactory.php | 4 +-- tests/fixtures/after_mapping.json | 22 ++---------- tests/fixtures/before_mapping.json | 36 +++---------------- tests/fixtures/latest_messages.json | 27 ++------------ 6 files changed, 48 insertions(+), 79 deletions(-) diff --git a/Modules/LlmDriver/app/ClaudeClient.php b/Modules/LlmDriver/app/ClaudeClient.php index 18cd1779..664cc881 100644 --- a/Modules/LlmDriver/app/ClaudeClient.php +++ b/Modules/LlmDriver/app/ClaudeClient.php @@ -5,6 +5,7 @@ use App\Models\Setting; use Illuminate\Http\Client\Pool; use Illuminate\Http\Client\Response; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; use LlmLaraHub\LlmDriver\Requests\MessageInDto; @@ -205,7 +206,13 @@ protected function getClient() public function functionPromptChat(array $messages, array $only = []): array { - $messages = $this->remapMessages($messages); + $messages = $this->remapMessages($messages, true); + + /** + * @NOTE + * The api will not let me end this array in an assistant message + * it has to end in a user message + */ Log::info('LlmDriver::ClaudeClient::functionPromptChat', $messages); @@ -305,7 +312,7 @@ public function getFunctions(): array * * @param MessageInDto[] $messages */ - protected function remapMessages(array $messages): array + protected function remapMessages(array $messages, bool $userLast = false): array { put_fixture('before_mapping.json', $messages); $messages = collect($messages)->map(function ($item) { @@ -348,6 +355,17 @@ protected function remapMessages(array $messages): array } + if ($userLast) { + $last = Arr::last($newMessagesArray); + + if($last['role'] === 'assistant') { + $newMessagesArray[] = [ + 'role' => 'user', + 'content' => 'Using the surrounding context to continue this response thread', + ]; + } + } + put_fixture('after_mapping.json', $newMessagesArray); return $newMessagesArray; diff --git a/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php b/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php index 0b04f878..14bebe21 100644 --- a/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php +++ b/Modules/LlmDriver/tests/Feature/ClaudeClientTest.php @@ -4,6 +4,8 @@ use App\Models\Setting; use Feature; +use Illuminate\Http\Client\Request; +use Illuminate\Support\Arr; use Illuminate\Support\Facades\Http; use LlmLaraHub\LlmDriver\ClaudeClient; use LlmLaraHub\LlmDriver\Requests\MessageInDto; @@ -162,6 +164,8 @@ public function test_get_functions(): void public function test_functions_prompt(): void { + Setting::factory()->all_have_keys()->create(); + Feature::define('llm-driver.claude.functions', function () { return true; }); @@ -171,6 +175,8 @@ public function test_functions_prompt(): void 'api.anthropic.com/*' => Http::response($data, 200), ]); + Http::preventStrayRequests(); + $openaiClient = new \LlmLaraHub\LlmDriver\ClaudeClient(); $response = $openaiClient->functionPromptChat([ MessageInDto::from([ @@ -181,9 +187,19 @@ public function test_functions_prompt(): void 'content' => 'test', 'role' => 'user', ]), + MessageInDto::from([ + 'content' => 'test should not be last', + 'role' => 'assistant', + ]), ]); $this->assertIsArray($response); $this->assertCount(1, $response); + + + Http::assertSent(function (Request $request) { + $last = Arr::last($request['messages']); + return $last['role'] === 'user' && count($request['messages']) === 4; + }); } } diff --git a/database/factories/SettingFactory.php b/database/factories/SettingFactory.php index 4deeac3e..f992b08f 100644 --- a/database/factories/SettingFactory.php +++ b/database/factories/SettingFactory.php @@ -52,11 +52,11 @@ public function all_have_keys(): Factory ]; $attributes['secrets']['ollama'] = [ 'api_key' => 'foobar', - 'api_url' => 'https://api.anthropic.com/v1', + 'api_url' => 'http://localhost:11434/api/', ]; $attributes['secrets']['claude'] = [ 'api_key' => 'foobar', - 'api_url' => 'http://localhost:11434/api/', + 'api_url' => 'https://api.anthropic.com/v1', ]; return $attributes; diff --git a/tests/fixtures/after_mapping.json b/tests/fixtures/after_mapping.json index 96654c26..65fd9183 100644 --- a/tests/fixtures/after_mapping.json +++ b/tests/fixtures/after_mapping.json @@ -1,34 +1,18 @@ [ { - "content": "Can you summarize the content for me", - "role": "user" - }, - { - "content": "Here is a concise summary of the content:\n\nThe article describes how to use LaraLlama, a tool that allows you to embed documents into a local Large Language Model (LLM) in the context of a Laravel web application. Key points:\n\n- LaraLlama enables seamless integration of document embedding capabilities into Laravel projects, allowing you to quickly surface relevant information from your document repository.\n- The article provides a step-by-step guide on setting up and using LaraLlama, including instructions on installing dependencies and configuring the system.\n- By leveraging local LLM embedding, LaraLlama allows efficient search and retrieval of information from documents, without the need for a centralized repository or cloud-based services.\n- This can be useful for organizations that need to quickly surface relevant information from internal documentation, without the overhead or security concerns of external services.\n\nOverall, the article highlights how LaraLlama can be a valuable tool for incorporating powerful document embedding capabilities into Laravel-based applications, enabling more efficient knowledge management and retrieval.", + "content": "test", "role": "assistant" }, { - "content": "what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool", + "content": "test", "role": "user" }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool```\n\n**Context from the database search of documents for Response**:\n```LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLlama Standards Checking Tool Content LaraLlama Standards Checking Tool We introduce in this release a Standards Checking tool. Just imagine you have a documentation team and when they write new content in their CMS it can then check the API LaraLlama provides to check it matches the Standards in your Collection. One - Easily choose a persona!Two - Find any of the ones you made in the \"Style Guide\" areaThree - LaraLlama will auto discover the tool to use but this helps for some LLMs like Ollama that do not have tools 100% working yet. Just upload the docume Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log Content Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log For those, like myself, who do not like to watch YouTube videos to learn something new (though I watch a ton of them ) here are the steps to using LaraLamma.ai to easily make an automation that will take GitHub Webhook Events (Pull-Requests, etc) and make a Change-Log.https:\/\/medium.com\/@alnutile\/laravel-rag-3-steps-to-import-commits-summarize-create-a-release-log-8f1d349b6a06The YouTube Video is P```", + "content": "test should not be last", "role": "assistant" }, { "role": "user", "content": "Using the surrounding context to continue this response thread" - }, - { - "content": "**Response:**\nThe context provided does not directly mention anything about RAG (Retrieval Augmented Generation) systems in relation to LaraLlama. The focus seems to be on how LaraLlama can be used by non-technical business owners to save time in their day-to-day tasks by allowing them to interact with their own data (documents, emails, etc.) through a natural language interface.\n\nSome key points from the context:\n\n- LaraLlama is described as \"more than just a RAG system\", implying it has capabilities beyond a typical RAG system.\n- The focus is on how LaraLlama allows users to \"chat with your own data\" and receive responses grounded in that data, without requiring technical expertise.\n- There are examples of how LaraLlama can be used to automate tasks like generating daily reports from emails, without the need for coding.\n- The overall message is that LaraLlama is designed to be an accessible tool for non-technical business users to leverage the power of language models and document embedding to streamline their work, rather than a technical deep dive into RAG systems.\n\nSo in summary, the context does not provide details about RAG systems specifically, but rather highlights how LaraLlama aims to empower regular business users to interact with their own data more efficiently, without requiring technical skills.", - "role": "assistant" - }, - { - "content": "How about email ideas", - "role": "user" - }, - { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```How about email ideas```\n\n**Context from the database search of documents for Response**:\n```Automate Email Replies in any Persona Needed Content Automate Email Replies in any Persona Needed Two new features in LaraLlama.io!Personas First, you can now add Personas to the system so you can then have it produce output in that voice. Imagine Marketing content, Customer Feedback etc.Email Reply Automation Then with a few clicks you can point LaraLlama.io to an Email box and have it reply to any of the emails in that box using the Persona (or not). For example you can have a Collection that focuses on HR content or Marketing content or Customer Support Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne```", - "role": "assistant" } ] \ No newline at end of file diff --git a/tests/fixtures/before_mapping.json b/tests/fixtures/before_mapping.json index 04b438a3..4bf7a9e0 100644 --- a/tests/fixtures/before_mapping.json +++ b/tests/fixtures/before_mapping.json @@ -1,48 +1,20 @@ [ { - "content": "Can you summarize the content for me", - "role": "user", - "is_ai": false, - "show": true, - "meta_data": null - }, - { - "content": "Here is a concise summary of the content:\n\nThe article describes how to use LaraLlama, a tool that allows you to embed documents into a local Large Language Model (LLM) in the context of a Laravel web application. Key points:\n\n- LaraLlama enables seamless integration of document embedding capabilities into Laravel projects, allowing you to quickly surface relevant information from your document repository.\n- The article provides a step-by-step guide on setting up and using LaraLlama, including instructions on installing dependencies and configuring the system.\n- By leveraging local LLM embedding, LaraLlama allows efficient search and retrieval of information from documents, without the need for a centralized repository or cloud-based services.\n- This can be useful for organizations that need to quickly surface relevant information from internal documentation, without the overhead or security concerns of external services.\n\nOverall, the article highlights how LaraLlama can be a valuable tool for incorporating powerful document embedding capabilities into Laravel-based applications, enabling more efficient knowledge management and retrieval.", - "role": "assistant", - "is_ai": false, - "show": true, - "meta_data": null - }, - { - "content": "what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool", - "role": "user", - "is_ai": false, - "show": true, - "meta_data": null - }, - { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool```\n\n**Context from the database search of documents for Response**:\n```LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLlama Standards Checking Tool Content LaraLlama Standards Checking Tool We introduce in this release a Standards Checking tool. Just imagine you have a documentation team and when they write new content in their CMS it can then check the API LaraLlama provides to check it matches the Standards in your Collection. One - Easily choose a persona!Two - Find any of the ones you made in the \"Style Guide\" areaThree - LaraLlama will auto discover the tool to use but this helps for some LLMs like Ollama that do not have tools 100% working yet. Just upload the docume Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log Content Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log For those, like myself, who do not like to watch YouTube videos to learn something new (though I watch a ton of them ) here are the steps to using LaraLamma.ai to easily make an automation that will take GitHub Webhook Events (Pull-Requests, etc) and make a Change-Log.https:\/\/medium.com\/@alnutile\/laravel-rag-3-steps-to-import-commits-summarize-create-a-release-log-8f1d349b6a06The YouTube Video is P```\n", - "role": "assistant", - "is_ai": false, - "show": true, - "meta_data": null - }, - { - "content": "\n\n**Response:**\nThe context provided does not directly mention anything about RAG (Retrieval Augmented Generation) systems in relation to LaraLlama. The focus seems to be on how LaraLlama can be used by non-technical business owners to save time in their day-to-day tasks by allowing them to interact with their own data (documents, emails, etc.) through a natural language interface.\n\nSome key points from the context:\n\n- LaraLlama is described as \"more than just a RAG system\", implying it has capabilities beyond a typical RAG system.\n- The focus is on how LaraLlama allows users to \"chat with your own data\" and receive responses grounded in that data, without requiring technical expertise.\n- There are examples of how LaraLlama can be used to automate tasks like generating daily reports from emails, without the need for coding.\n- The overall message is that LaraLlama is designed to be an accessible tool for non-technical business users to leverage the power of language models and document embedding to streamline their work, rather than a technical deep dive into RAG systems.\n\nSo in summary, the context does not provide details about RAG systems specifically, but rather highlights how LaraLlama aims to empower regular business users to interact with their own data more efficiently, without requiring technical skills.", - "role": "assistant", + "content": "test", + "role": "system", "is_ai": false, "show": true, "meta_data": null }, { - "content": "How about email ideas", + "content": "test", "role": "user", "is_ai": false, "show": true, "meta_data": null }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```How about email ideas```\n\n**Context from the database search of documents for Response**:\n```Automate Email Replies in any Persona Needed Content Automate Email Replies in any Persona Needed Two new features in LaraLlama.io!Personas First, you can now add Personas to the system so you can then have it produce output in that voice. Imagine Marketing content, Customer Feedback etc.Email Reply Automation Then with a few clicks you can point LaraLlama.io to an Email box and have it reply to any of the emails in that box using the Persona (or not). For example you can have a Collection that focuses on HR content or Marketing content or Customer Support Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne```\n", + "content": "test should not be last", "role": "assistant", "is_ai": false, "show": true, diff --git a/tests/fixtures/latest_messages.json b/tests/fixtures/latest_messages.json index 847e8c15..0535c185 100644 --- a/tests/fixtures/latest_messages.json +++ b/tests/fixtures/latest_messages.json @@ -1,44 +1,23 @@ [ { - "content": "Can you summarize the content for me", - "role": "user", - "is_ai": false, - "show": true, - "meta_data": null - }, - { - "content": "Here is a concise summary of the content:\n\nThe article describes how to use LaraLlama, a tool that allows you to embed documents into a local Large Language Model (LLM) in the context of a Laravel web application. Key points:\n\n- LaraLlama enables seamless integration of document embedding capabilities into Laravel projects, allowing you to quickly surface relevant information from your document repository.\n- The article provides a step-by-step guide on setting up and using LaraLlama, including instructions on installing dependencies and configuring the system.\n- By leveraging local LLM embedding, LaraLlama allows efficient search and retrieval of information from documents, without the need for a centralized repository or cloud-based services.\n- This can be useful for organizations that need to quickly surface relevant information from internal documentation, without the overhead or security concerns of external services.\n\nOverall, the article highlights how LaraLlama can be a valuable tool for incorporating powerful document embedding capabilities into Laravel-based applications, enabling more efficient knowledge management and retrieval.", - "role": "assistant", - "is_ai": false, - "show": true, - "meta_data": null - }, - { - "content": "what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool", + "content": "How about email ideas", "role": "user", "is_ai": false, "show": true, "meta_data": null }, { - "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```what does it say about RAG\nThese are business owners who want to learn how an LLM can work for them.\nThey are not technical but want to see how LaraLlama can save them time in normal day to day tasks.\nThey want to understand how normal users can use this tool```\n\n**Context from the database search of documents for Response**:\n```LaraLlama - More than just a RAG System Content LaraLlama - More than just a RAG System What is a RAG System?A RAG (Retrieval Augmented Generation) system is a powerful AI-driven technology that combines the strengths of retrieval-based and generation-based approaches to provide more contextual and accurate responses. At the core of a RAG system is the ability to \"chat\" with your own data, whether it's PDFs, PowerPoints, or any other content, and receive responses that are grounded in the context of that data.TLDR: Using your data, vector search, and a large language m LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLlama Standards Checking Tool Content LaraLlama Standards Checking Tool We introduce in this release a Standards Checking tool. Just imagine you have a documentation team and when they write new content in their CMS it can then check the API LaraLlama provides to check it matches the Standards in your Collection. One - Easily choose a persona!Two - Find any of the ones you made in the \"Style Guide\" areaThree - LaraLlama will auto discover the tool to use but this helps for some LLMs like Ollama that do not have tools 100% working yet. Just upload the docume Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log Content Laravel RAG 3 Steps to Import Commits, Summarize & Create a Release Log For those, like myself, who do not like to watch YouTube videos to learn something new (though I watch a ton of them ) here are the steps to using LaraLamma.ai to easily make an automation that will take GitHub Webhook Events (Pull-Requests, etc) and make a Change-Log.https:\/\/medium.com\/@alnutile\/laravel-rag-3-steps-to-import-commits-summarize-create-a-release-log-8f1d349b6a06The YouTube Video is P```\n", + "content": "**Role**\nA Summarization and Prompt Answering system that sticks to the context in this prompt.\n**Task**\nUsing the context of the prompt and the users query return a concise, clear, and accurate response.\n**Format**\nDeliver the response in a concise, clear Markdown format (Text). Use quotes as needed from the context.\n\n[DO NOT INCLUDE THE ABOVE IN THE RESPONSE]\n\n**The User's Query**:\n```How about email ideas```\n\n**Context from the database search of documents for Response**:\n```Automate Email Replies in any Persona Needed Content Automate Email Replies in any Persona Needed Two new features in LaraLlama.io!Personas First, you can now add Personas to the system so you can then have it produce output in that voice. Imagine Marketing content, Customer Feedback etc.Email Reply Automation Then with a few clicks you can point LaraLlama.io to an Email box and have it reply to any of the emails in that box using the Persona (or not). For example you can have a Collection that focuses on HR content or Marketing content or Customer Support Laravel + LLM = Automated Email Reports (and more) Content Laravel + LLM = Automated Email Reports (and more) Read and watch more about this key topic here https:\/\/medium.com\/@alnutile\/laravel-llm-automated-email-reports-6c8943b199aaPosted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Read how LaraLlama Embeds Documents Content Read how LaraLlama Embeds Documents Read more about it here https:\/\/medium.com\/@alnutile\/local-llm-and-laravel-in-10-minutes-with-local-llm-embedding-for-free-ac96e49288d2Posted on: June 8th, 2024 On: Blog how Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newsletter LaraLamma - Email to Daily Report in 2 Steps - No Code Content LaraLamma - Email to Daily Report in 2 Steps - No Code Turn Marketing Emails, Customer Feedback Emails and more into a daily report sent to you or your team! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog C Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Doc Site Released! Content Doc Site Released! Start learning about LaraLlama at https:\/\/docs.larallama.io\/See numerous Use Cases to quickly, with no code, start automation common workflows at your company! https:\/\/docs.larallama.io\/use-cases.html Posted on: June 7th, 2024 On: Press Release inspiration technology newsletter Share this on social media Facebook Twitter Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Newslette Turn your Docs into a Support Chat Widget Content Turn your Docs into a Support Chat Widget This YouTube video will show you how easily you can turn GitHub Webhooks into a unified Change-Log! Posted on: June 8th, 2024 By: LaraLlama Team On: Blog automations Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info Getting Started with LaraChain (LaraLamma) Content Getting Started with LaraChain (LaraLamma) This video will help you get started with LaraLlama.io Posted on: June 8th, 2024 By: LaraLlama Team On: Blog help intro Share this on social media Facebook Twitter About the author LaraLlama Team A Team with 20+ years experience with Laravel and 2 years building LLM based applications Copyright 2024. LaraLlama LaraLlama.io Consulting Blog Contact Us Reach Us info@larallama.io +1-413-225-1844 Ne```\n", "role": "assistant", "is_ai": false, "show": true, "meta_data": null }, { - "content": "\n\n**Response:**\nThe context provided does not directly mention anything about RAG (Retrieval Augmented Generation) systems in relation to LaraLlama. The focus seems to be on how LaraLlama can be used by non-technical business owners to save time in their day-to-day tasks by allowing them to interact with their own data (documents, emails, etc.) through a natural language interface.\n\nSome key points from the context:\n\n- LaraLlama is described as \"more than just a RAG system\", implying it has capabilities beyond a typical RAG system.\n- The focus is on how LaraLlama allows users to \"chat with your own data\" and receive responses grounded in that data, without requiring technical expertise.\n- There are examples of how LaraLlama can be used to automate tasks like generating daily reports from emails, without the need for coding.\n- The overall message is that LaraLlama is designed to be an accessible tool for non-technical business users to leverage the power of language models and document embedding to streamline their work, rather than a technical deep dive into RAG systems.\n\nSo in summary, the context does not provide details about RAG systems specifically, but rather highlights how LaraLlama aims to empower regular business users to interact with their own data more efficiently, without requiring technical skills.", + "content": "\n\n**Response**:\n\nHere are some email ideas based on the context provided:\n\n1. **Automate Email Replies in Any Persona Needed**: You can set up personas in LaraLlama.io and have it automatically reply to emails in those personas, such as marketing, customer feedback, or customer support.\n\n2. **Automated Email Reports**: LaraLlama.io can be used to automatically generate email reports from your data, without the need for manual effort.\n\n3. **Turn Emails into a Daily Report**: You can use LaraLlama.io to turn marketing emails, customer feedback, and other types of emails into a daily report that gets sent to you or your team.\n\n4. **Turn Your Docs into a Support Chat Widget**: LaraLlama.io can help you turn your documentation into an interactive chat widget to provide support to your customers.\n\n5. **Getting Started with LaraChain (LaraLlama)**: If you're new to LaraLlama.io, there are resources available, like videos, to help you get started with the platform.\n\nThe key ideas here are automating email workflows, generating reports from email data, and leveraging LaraLlama.io's capabilities to enhance your email-related processes.", "role": "assistant", "is_ai": false, "show": true, "meta_data": null - }, - { - "content": "How about email ideas", - "role": "user", - "is_ai": false, - "show": true, - "meta_data": null } ] \ No newline at end of file From 4fb1dbd80b0862ecb1efad7fe609dc1ddb057954 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Fri, 5 Jul 2024 13:37:11 -0400 Subject: [PATCH 13/25] =?UTF-8?q?odd=20bug=20new=20chat=20did=20not=20moun?= =?UTF-8?q?t=20the=20websocket=20=20=20t=20=F0=9F=A4=94ohoh=20is=20this=20?= =?UTF-8?q?why=20reverb=20had=20problems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/js/Pages/Collection/Chat.vue | 26 +++++++++++++------ .../Collection/Components/ChatSideNav.vue | 8 +++++- .../Collection/Components/CreateChat.vue | 7 +++-- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/resources/js/Pages/Collection/Chat.vue b/resources/js/Pages/Collection/Chat.vue index e0efda6a..76e9cff3 100644 --- a/resources/js/Pages/Collection/Chat.vue +++ b/resources/js/Pages/Collection/Chat.vue @@ -32,14 +32,23 @@ const props = defineProps({ provide('system_prompt', props.system_prompt); onMounted(() => { + mountItems(); +}); + +const chatCreated = () => { + mountItems(); +} + + +const mountItems = () => { Echo.private(`collection.chat.${props.collection.data.id}.${props.chat.data.id}`) - .listen('.status', (e) => { - router.reload({ - preserveScroll: true, + .listen('.status', (e) => { + router.reload({ + preserveScroll: true, + }) }) - }) - .listen('.update', (e) => { - toast.success(e.updateMessage, { + .listen('.update', (e) => { + toast.success(e.updateMessage, { position: "bottom-right", timeout: 2000, closeOnClick: true, @@ -53,8 +62,8 @@ onMounted(() => { icon: true, rtl: false }); - }); -}); + }); +} onUnmounted(() => { Echo.leave(`collection.chat.${props.collection.data.id}.${props.chat.data.id}`); @@ -72,6 +81,7 @@ onUnmounted(() => {
diff --git a/resources/js/Pages/Collection/Components/ChatSideNav.vue b/resources/js/Pages/Collection/Components/ChatSideNav.vue index 72e3788e..ec5cabbd 100644 --- a/resources/js/Pages/Collection/Components/ChatSideNav.vue +++ b/resources/js/Pages/Collection/Components/ChatSideNav.vue @@ -5,6 +5,12 @@ const props = defineProps({ chats: Object, collection: Object }) + +const emits = defineEmits(['chatCreated']); + +const chatCreated = () => { + emits('chatCreated'); +}