-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mock driver working with summary and vector
- Loading branch information
Showing
16 changed files
with
66 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,22 @@ | ||
<?php | ||
<?php | ||
|
||
namespace App\LlmDriver; | ||
|
||
use App\LlmDriver\Responses\EmbeddingsResponseDto; | ||
use Illuminate\Support\Facades\Log; | ||
use OpenAI\Resources\Embeddings; | ||
|
||
abstract class BaseClient { | ||
|
||
public function embedData(string $data) : EmbeddingsResponseDto { | ||
abstract class BaseClient | ||
{ | ||
public function embedData(string $data): EmbeddingsResponseDto | ||
{ | ||
|
||
Log::info('LlmDriver::MockClient::embedData'); | ||
|
||
Log::info("LlmDriver::MockClient::embedData"); | ||
|
||
$data = get_fixture('embedding_response.json'); | ||
|
||
return new EmbeddingsResponseDto( | ||
data_get($data, 'data.0.embedding'), | ||
1000, | ||
); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
<?php | ||
<?php | ||
|
||
namespace App\LlmDriver; | ||
|
||
use App\LlmDriver\Responses\CompletionResponse; | ||
use App\LlmDriver\Responses\EmbeddingsResponseDto; | ||
use Illuminate\Support\Facades\Log; | ||
use OpenAI\Resources\Embeddings; | ||
|
||
class MockClient extends BaseClient { | ||
|
||
public function completion(string $prompt) : CompletionResponse { | ||
Log::info("LlmDriver::MockClient::completion"); | ||
$data = <<<EOD | ||
class MockClient extends BaseClient | ||
{ | ||
public function completion(string $prompt): CompletionResponse | ||
{ | ||
Log::info('LlmDriver::MockClient::completion'); | ||
|
||
$data = <<<'EOD' | ||
Voluptate irure cillum dolor anim officia reprehenderit dolor. Eiusmod veniam nostrud consectetur incididunt proident id. Anim adipisicing pariatur amet duis Lorem sunt veniam veniam est. Deserunt ea aliquip cillum pariatur consectetur. Dolor in reprehenderit adipisicing consectetur cupidatat ad cupidatat reprehenderit. Nostrud mollit voluptate aliqua anim pariatur excepteur eiusmod velit quis exercitation tempor quis excepteur. | ||
EOD; | ||
|
||
return new CompletionResponse($data); | ||
} | ||
|
||
|
||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
<?php | ||
<?php | ||
|
||
return [ | ||
'driver' => env("LLM_DRIVER", "mock"), | ||
'driver' => env('LLM_DRIVER', 'mock'), | ||
|
||
"drivers" => | ||
[ | ||
"mock" => [ | ||
'drivers' => [ | ||
'mock' => [ | ||
|
||
], | ||
"openai" => [ | ||
"api_key" => env("OPENAI_API_KEY"), | ||
"api_url" => env("OPENAI_API_URL", "https://api.openai.com/v1/engines/davinci-codex/completions") | ||
'openai' => [ | ||
'api_key' => env('OPENAI_API_KEY'), | ||
'api_url' => env('OPENAI_API_URL', 'https://api.openai.com/v1/engines/davinci-codex/completions'), | ||
], | ||
"azure" => [ | ||
'azure' => [ | ||
|
||
], | ||
"ollama" => [ | ||
'ollama' => [ | ||
|
||
], | ||
] | ||
]; | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.