Skip to content

Commit

Permalink
start plugging in a function
Browse files Browse the repository at this point in the history
  • Loading branch information
alnutile committed Mar 30, 2024
1 parent 4fd75f4 commit 4ab9e6f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
3 changes: 0 additions & 3 deletions app/LlmDriver/Functions/ArgumentCaster.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

namespace App\LlmDriver;


use Spatie\LaravelData\Casts\Cast;
use Spatie\LaravelData\Casts\Castable;
use Spatie\LaravelData\Support\Creation\CreationContext;
use Spatie\LaravelData\Support\DataProperty;

class ArgumentCaster implements Castable
{


public static function dataCastUsing(...$arguments): Cast
{
return new class implements Cast
Expand Down
10 changes: 4 additions & 6 deletions app/LlmDriver/Functions/FunctionContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
abstract class FunctionContract
{
protected string $name;

protected string $dscription;

/**
Expand All @@ -31,16 +31,14 @@ protected function getName(): string
return $this->name;
}


/**
*
* @return ParameterDto[]
* @return ParameterDto[]
*/
protected function getParameters(): array {
protected function getParameters(): array
{
return [];
}


protected function getDescription(): string
{
return $this->name;
Expand Down
23 changes: 11 additions & 12 deletions app/LlmDriver/Functions/SearchAndSummarize.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?php
<?php

namespace App\LlmDriver\Functions;

class SearchAndSummarize extends FunctionContract {
class SearchAndSummarize extends FunctionContract
{
protected string $name = 'search_and_summarize';

protected string $name = "search_and_summarize";

protected string $dscription = "Used to embed users prompt, search database and return summarized results.";
protected string $dscription = 'Used to embed users prompt, search database and return summarized results.';

public function handle(FunctionCallDto $functionCallDto): array {
public function handle(FunctionCallDto $functionCallDto): array
{

return [];
}

/**
*
* @return ParameterDto[]
* @return ParameterDto[]
*/
protected function getParameters(): array {
protected function getParameters(): array
{
return [
new ParameterDto(
name: 'prompt',
Expand All @@ -28,5 +28,4 @@ protected function getParameters(): array {
),
];
}

}
}

0 comments on commit 4ab9e6f

Please sign in to comment.