-
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.
- Loading branch information
Showing
6 changed files
with
36 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,44 @@ | ||
<?php | ||
<?php | ||
|
||
namespace App\LlmDriver\Functions; | ||
|
||
abstract class FunctionContract | ||
{ | ||
protected string $name; | ||
|
||
protected string $dscription; | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
* @return array<string, mixed> | ||
*/ | ||
abstract public function handle(array $data): array; | ||
|
||
public function getName(): string | ||
public function getFunction(): FunctionDto | ||
{ | ||
return $this->name; | ||
} | ||
return FunctionDto::from( | ||
[ | ||
'name' => $this->getName(), | ||
'description' => $this->getDescription(), | ||
'parameters' => $this->getParameters(), | ||
] | ||
); | ||
|
||
public function getFunction() : FunctionDto { | ||
return new FunctionDto($this->name, $this->getParameters()); | ||
|
||
} | ||
|
||
protected function getName(): string | ||
{ | ||
return $this->name; | ||
} | ||
|
||
abstract public function getParameters(): array; | ||
|
||
protected function getParameters(): array { | ||
return []; | ||
} | ||
|
||
|
||
/** | ||
* @param array<string, mixed> $data | ||
* @return array<string, mixed> | ||
*/ | ||
abstract public function handle(array $data): array; | ||
} | ||
protected function getDescription(): string | ||
{ | ||
return $this->name; | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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