|
6 | 6 | use App\Domains\Agents\VerifyPromptOutputDto; |
7 | 7 | use App\Domains\Messages\RoleEnum; |
8 | 8 | use App\Domains\Prompts\SummarizePrompt; |
| 9 | +use App\Models\Chat; |
| 10 | +use App\Models\Message; |
9 | 11 | use App\Models\PromptHistory; |
10 | 12 | use Facades\App\Domains\Agents\VerifyResponseAgent; |
11 | 13 | use Facades\LlmLaraHub\LlmDriver\DistanceQuery; |
@@ -108,10 +110,28 @@ public function handle( |
108 | 110 |
|
109 | 111 | notify_ui($model, 'Building Summary'); |
110 | 112 |
|
111 | | - /** @var CompletionResponse $response */ |
112 | | - $response = LlmDriverFacade::driver( |
113 | | - $model->getChatable()->getDriver() |
114 | | - )->completion($contentFlattened); |
| 113 | + |
| 114 | + if(!get_class($model) === Chat::class) { |
| 115 | + Log::info('[LaraChain] Using the Simple Completion', [ |
| 116 | + 'input' => $contentFlattened, |
| 117 | + 'driver' => $model->getChatable()->getDriver(), |
| 118 | + ]); |
| 119 | + /** @var CompletionResponse $response */ |
| 120 | + $response = LlmDriverFacade::driver( |
| 121 | + $model->getChatable()->getDriver() |
| 122 | + )->completion($contentFlattened); |
| 123 | + } else { |
| 124 | + Log::info('[LaraChain] Using the Chat Completion', [ |
| 125 | + 'input' => $contentFlattened, |
| 126 | + 'driver' => $model->getChatable()->getDriver(), |
| 127 | + ]); |
| 128 | + $messages = $model->getChat()->getChatResponse(); |
| 129 | + |
| 130 | + /** @var CompletionResponse $response */ |
| 131 | + $response = LlmDriverFacade::driver( |
| 132 | + $model->getChatable()->getDriver() |
| 133 | + )->chat($messages); |
| 134 | + } |
115 | 135 |
|
116 | 136 | $this->response = $response->content; |
117 | 137 |
|
|
0 commit comments