Skip to content

Commit

Permalink
start moving the work into modules
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Apr 14, 2024
1 parent a6c1450 commit a65ece0
Show file tree
Hide file tree
Showing 144 changed files with 12,425 additions and 138 deletions.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions Modules/Foundation/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Foundation",
"alias": "foundation",
"description": "",
"keywords": [],
"priority": 0,
"providers": [

],
"files": []
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
3 changes: 1 addition & 2 deletions app/LlmDriver/readme.md → Modules/LlmDriver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ return [
App\Providers\FortifyServiceProvider::class,
App\Providers\HorizonServiceProvider::class,
App\Providers\JetstreamServiceProvider::class,
App\LlmDriver\LlmServiceProvider::class,
\LlmLaraHub\LlmDriver\LlmServiceProvider::class,
];

```
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\CompletionResponse;
use App\LlmDriver\Responses\EmbeddingsResponseDto;
use Illuminate\Support\Facades\Log;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\CompletionResponse;
use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto;

abstract class BaseClient
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\CompletionResponse;
use App\LlmDriver\Responses\EmbeddingsResponseDto;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\CompletionResponse;
use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto;

class ClaudeClient extends BaseClient
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

enum DriversEnum: string
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Support\Creation\CreationContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

use Spatie\LaravelData\Attributes\WithCast;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\FunctionResponse;
use App\Models\Chat;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\FunctionResponse;

abstract class FunctionContract
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

class FunctionDto extends \Spatie\LaravelData\Data
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

class ParametersDto extends \Spatie\LaravelData\Data
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

class PropertyDto extends \Spatie\LaravelData\Data
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

use App\LlmDriver\Responses\FunctionResponse;
use App\Models\Chat;
use LlmLaraHub\LlmDriver\Responses\FunctionResponse;

class SearchAndSummarize extends FunctionContract
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace App\LlmDriver\Functions;
namespace LlmLaraHub\LlmDriver\Functions;

use App\Domains\Messages\RoleEnum;
use App\LlmDriver\LlmDriverFacade;
use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\FunctionResponse;
use App\Models\Chat;
use Illuminate\Support\Facades\Log;
use LlmLaraHub\LlmDriver\LlmDriverFacade;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\FunctionResponse;

class SummarizeCollection extends FunctionContract
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

interface HasDrivers
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Helpers;
namespace LlmLaraHub\LlmDriver\Helpers;

use voku\helper\StopWords;
use Wamania\Snowball\StemmerFactory;
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\LlmDriver\Functions\SummarizeCollection;
use LlmLaraHub\LlmDriver\Functions\SummarizeCollection;

class LlmDriverClient
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use Illuminate\Support\Facades\Facade;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\LlmDriver\Functions\SearchAndSummarize;
use App\LlmDriver\Functions\SummarizeCollection;
use Illuminate\Support\ServiceProvider;
use LlmLaraHub\LlmDriver\Functions\SearchAndSummarize;
use LlmLaraHub\LlmDriver\Functions\SummarizeCollection;

class LlmServiceProvider extends ServiceProvider
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

class MockClient extends BaseClient
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\CompletionResponse;
use App\LlmDriver\Responses\EmbeddingsResponseDto;
use Illuminate\Contracts\Container\BindingResolutionException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Laravel\Pennant\Feature;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\CompletionResponse;
use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto;

class OllamaClient extends BaseClient
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\CompletionResponse;
use App\LlmDriver\Responses\EmbeddingsResponseDto;
use Illuminate\Support\Facades\Log;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\CompletionResponse;
use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto;
use OpenAI\Laravel\Facades\OpenAI;

class OpenAiClient extends BaseClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

namespace App\LlmDriver;
namespace LlmLaraHub\LlmDriver;

use App\Domains\Messages\RoleEnum;
use App\Events\ChatUiUpdateEvent;
use App\LlmDriver\Functions\FunctionCallDto;
use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\FunctionResponse;
use App\Models\Chat;
use Facades\App\Domains\Messages\SearchOrSummarizeChatRepo;
use Illuminate\Support\Arr;
use LlmLaraHub\LlmDriver\Functions\FunctionCallDto;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\FunctionResponse;

class Orchestrate
{
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Requests;
namespace LlmLaraHub\LlmDriver\Requests;

use Spatie\LaravelData\Data;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Responses;
namespace LlmLaraHub\LlmDriver\Responses;

class CompletionResponse extends \Spatie\LaravelData\Data
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Responses;
namespace LlmLaraHub\LlmDriver\Responses;

use Pgvector\Laravel\Vector;
use Spatie\LaravelData\Attributes\WithCastable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Responses;
namespace LlmLaraHub\LlmDriver\Responses;

/**
* @NOTE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\LlmDriver\Responses;
namespace LlmLaraHub\LlmDriver\Responses;

use Pgvector\Laravel\Vector;
use Spatie\LaravelData\Casts\Cast;
Expand Down
28 changes: 28 additions & 0 deletions Modules/LlmDriver/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "llmlarahub/llmdriver",
"description": "Driver for any LLM",
"authors": [
{
"name": "Alfred Nutile",
"email": "[email protected]"
}
],
"extra": {
"laravel": {
"providers": [],
"aliases": {

}
}
},
"autoload": {
"psr-4": {
"LlmLaraHub\\LlmDriver\\": "app/"
}
},
"autoload-dev": {
"psr-4": {
"LlmLaraHub\\LlmDriver\\Tests\\": "tests/"
}
}
}
Empty file.
Empty file.
Empty file.
Empty file.
11 changes: 11 additions & 0 deletions Modules/LlmDriver/module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "LlmDriver",
"alias": "llmdriver",
"description": "",
"keywords": [],
"priority": 0,
"providers": [

],
"files": []
}
Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Tests\Feature;

use App\LlmDriver\ClaudeClient;
use App\LlmDriver\Requests\MessageInDto;
use App\LlmDriver\Responses\CompletionResponse;
use App\LlmDriver\Responses\EmbeddingsResponseDto;
use Illuminate\Support\Facades\Http;
use LlmLaraHub\LlmDriver\ClaudeClient;
use LlmLaraHub\LlmDriver\Requests\MessageInDto;
use LlmLaraHub\LlmDriver\Responses\CompletionResponse;
use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto;
use Tests\TestCase;

class ClaudeClientTest extends TestCase
Expand Down Expand Up @@ -120,7 +120,7 @@ public function test_chat_with_multiple_assistant_messages(): void

public function test_get_functions(): void
{
$openaiClient = new \App\LlmDriver\ClaudeClient();
$openaiClient = new \LlmLaraHub\LlmDriver\ClaudeClient();
$response = $openaiClient->getFunctions();
$this->assertNotEmpty($response);
$this->assertIsArray($response);
Expand All @@ -141,7 +141,7 @@ public function test_functions_prompt(): void
'api.anthropic.com/*' => Http::response($data, 200),
]);

$openaiClient = new \App\LlmDriver\ClaudeClient();
$openaiClient = new \LlmLaraHub\LlmDriver\ClaudeClient();
$response = $openaiClient->functionPromptChat([
MessageInDto::from([
'content' => 'test',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Tests\Feature;

use App\LlmDriver\LlmDriverFacade;
use App\LlmDriver\MockClient;
use App\LlmDriver\OpenAiClient;
use LlmLaraHub\LlmDriver\LlmDriverFacade;
use LlmLaraHub\LlmDriver\MockClient;
use LlmLaraHub\LlmDriver\OpenAiClient;
use Tests\TestCase;

class LlmDriverClientTest extends TestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace Tests\Feature;

use App\LlmDriver\LlmDriverFacade;
use App\LlmDriver\Responses\EmbeddingsResponseDto;
use LlmLaraHub\LlmDriver\LlmDriverFacade;
use LlmLaraHub\LlmDriver\Responses\EmbeddingsResponseDto;
use Tests\TestCase;

class LlmDriverFacadeTest extends TestCase
Expand Down
File renamed without changes.
Loading

0 comments on commit a65ece0

Please sign in to comment.