Skip to content

Commit

Permalink
add function checker
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Apr 2, 2024
1 parent abfdfcb commit 188c4cd
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
11 changes: 0 additions & 11 deletions app/Http/Controllers/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use App\Http\Resources\ChatResource;
use App\Http\Resources\CollectionResource;
use App\Http\Resources\MessageResource;
use App\LlmDriver\LlmDriverFacade;
use App\Models\Chat;
use App\Models\Collection;
use Facades\App\Domains\Messages\SearchOrSummarizeChatRepo;
Expand Down Expand Up @@ -45,16 +44,6 @@ public function chat(Chat $chat)
'input' => 'required|string',
]);

//get all the functions we have

$response = LlmDriverFacade::driver(
$chat->chatable->getDriver()
)->chat($validated['input']);
//attach them the the initial request
//see if we get results or a function request
//if we get a function request, we run the function
//if we get results, we return the results

$response = SearchOrSummarizeChatRepo::search($chat, $validated['input']);

ChatUpdatedEvent::dispatch($chat->chatable, $chat);
Expand Down
2 changes: 0 additions & 2 deletions app/LlmDriver/Functions/FunctionContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace App\LlmDriver\Functions;

use App\LlmDriver\Functions\PropertyDto;

abstract class FunctionContract
{
protected string $name;
Expand Down
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</source>
<php>
<env name="APP_ENV" value="testing"/>
<env name="BROADCAST_CONNECTION" value="null"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/>
<env name="CACHE_STORE" value="array"/>
Expand Down
1 change: 0 additions & 1 deletion tests/Feature/OpenAiClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public function test_get_functions(): void
$expected = get_fixture('openai_client_get_functions.json');

$this->assertEquals($expected, $response);

}

public function test_openai_client(): void
Expand Down
20 changes: 18 additions & 2 deletions tests/fixtures/claude_messages_debug.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
[
{
"content": "how does the document define 'Generative AI'",
"content": "test",
"role": "user"
},
{
"content": "The user uploaded documents that the user will ask questions about. Please keep your answers related to the documents.",
"content": "test 1",
"role": "assistant"
},
{
"role": "user",
"content": "Continuation of search results"
},
{
"content": "test 2",
"role": "assistant"
},
{
"role": "user",
"content": "Continuation of search results"
},
{
"content": "test 3",
"role": "assistant"
}
]

0 comments on commit 188c4cd

Please sign in to comment.