From 7b887938b2501ae7a89edb1c7e1bda510a5a6d07 Mon Sep 17 00:00:00 2001 From: Alfred Nutile Date: Sun, 4 Aug 2024 14:48:49 -0400 Subject: [PATCH] this will start to make just chat work with tools then we can limit the open area to the tools below --- Modules/LlmDriver/app/BaseClient.php | 1 + Modules/LlmDriver/app/LlmDriverClient.php | 2 -- Modules/LlmDriver/app/OllamaClient.php | 2 +- app/Jobs/SummarizeDocumentJob.php | 4 ---- app/Models/Message.php | 6 +----- tests/Feature/OllamaChatCompletionResponseTest.php | 1 - tests/Feature/OllamaCompletionResponseTest.php | 2 -- 7 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Modules/LlmDriver/app/BaseClient.php b/Modules/LlmDriver/app/BaseClient.php index c9daf6ff..bb809ec6 100644 --- a/Modules/LlmDriver/app/BaseClient.php +++ b/Modules/LlmDriver/app/BaseClient.php @@ -71,6 +71,7 @@ public function modifyPayload(array $payload, bool $noTools = false): array } put_fixture('ollama_modified_payload.json', $payload); + return $payload; } diff --git a/Modules/LlmDriver/app/LlmDriverClient.php b/Modules/LlmDriver/app/LlmDriverClient.php index 9deaf3f7..6d3c1671 100644 --- a/Modules/LlmDriver/app/LlmDriverClient.php +++ b/Modules/LlmDriver/app/LlmDriverClient.php @@ -2,8 +2,6 @@ namespace LlmLaraHub\LlmDriver; -use LlmLaraHub\LlmDriver\Functions\FunctionDto; - class LlmDriverClient { protected $drivers = []; diff --git a/Modules/LlmDriver/app/OllamaClient.php b/Modules/LlmDriver/app/OllamaClient.php index 1583f2b5..0d3302b1 100644 --- a/Modules/LlmDriver/app/OllamaClient.php +++ b/Modules/LlmDriver/app/OllamaClient.php @@ -7,7 +7,6 @@ use Illuminate\Http\Client\Pool; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; -use Illuminate\Support\Str; use Laravel\Pennant\Feature; use LlmLaraHub\LlmDriver\Requests\MessageInDto; use LlmLaraHub\LlmDriver\Responses\CompletionResponse; @@ -200,6 +199,7 @@ public function completion(string $prompt): CompletionResponse } put_fixture('ollama_completion.json', $response->json()); + return OllamaCompletionResponse::from($response->json()); } diff --git a/app/Jobs/SummarizeDocumentJob.php b/app/Jobs/SummarizeDocumentJob.php index 980e1891..c5890f4c 100644 --- a/app/Jobs/SummarizeDocumentJob.php +++ b/app/Jobs/SummarizeDocumentJob.php @@ -2,12 +2,9 @@ namespace App\Jobs; -use App\Domains\Agents\VerifyPromptInputDto; -use App\Domains\Agents\VerifyPromptOutputDto; use App\Domains\Documents\StatusEnum; use App\Domains\Prompts\SummarizeDocumentPrompt; use App\Models\Document; -use Facades\App\Domains\Agents\VerifyResponseAgent; use Facades\App\Domains\Tokenizer\Templatizer; use Illuminate\Bus\Batchable; use Illuminate\Bus\Queueable; @@ -16,7 +13,6 @@ use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Log; -use Laravel\Pennant\Feature; use LlmLaraHub\LlmDriver\LlmDriverFacade; use LlmLaraHub\LlmDriver\Responses\CompletionResponse; diff --git a/app/Models/Message.php b/app/Models/Message.php index 3a4b8866..5c51dcd8 100644 --- a/app/Models/Message.php +++ b/app/Models/Message.php @@ -5,11 +5,9 @@ use App\Domains\Chat\MetaDataDto; use App\Domains\Chat\ToolsDto; use App\Domains\Messages\RoleEnum; -use Facades\App\Domains\Orchestration\OrchestrateVersionTwo; use App\Events\ChatUiUpdateEvent; use App\Events\MessageCreatedEvent; -use App\Jobs\OrchestrateJob; -use App\Jobs\SimpleRetrieveRelatedOrchestrateJob; +use Facades\App\Domains\Orchestration\OrchestrateVersionTwo; use Facades\App\Domains\Tokenizer\Templatizer; use Illuminate\Bus\Batch; use Illuminate\Database\Eloquent\Factories\HasFactory; @@ -18,10 +16,8 @@ use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Support\Facades\Bus; -use Illuminate\Support\Facades\Log; use LlmLaraHub\LlmDriver\HasDrivers; use LlmLaraHub\LlmDriver\HasDriversTrait; -use LlmLaraHub\LlmDriver\LlmDriverFacade; class Message extends Model implements HasDrivers { diff --git a/tests/Feature/OllamaChatCompletionResponseTest.php b/tests/Feature/OllamaChatCompletionResponseTest.php index cd45c4a1..da3aad89 100644 --- a/tests/Feature/OllamaChatCompletionResponseTest.php +++ b/tests/Feature/OllamaChatCompletionResponseTest.php @@ -4,7 +4,6 @@ use Illuminate\Support\Arr; use LlmLaraHub\LlmDriver\Responses\OllamaChatCompletionResponse; -use LlmLaraHub\LlmDriver\Responses\OllamaCompletionResponse; use LlmLaraHub\LlmDriver\Responses\OllamaToolDto; use Tests\TestCase; diff --git a/tests/Feature/OllamaCompletionResponseTest.php b/tests/Feature/OllamaCompletionResponseTest.php index 8d5603be..cbb98310 100644 --- a/tests/Feature/OllamaCompletionResponseTest.php +++ b/tests/Feature/OllamaCompletionResponseTest.php @@ -2,9 +2,7 @@ namespace Tests\Feature; -use Illuminate\Support\Arr; use LlmLaraHub\LlmDriver\Responses\OllamaCompletionResponse; -use LlmLaraHub\LlmDriver\Responses\OllamaToolDto; use Tests\TestCase; class OllamaCompletionResponseTest extends TestCase