diff options
author | Marcel Klehr <mklehr@gmx.net> | 2023-06-20 18:26:29 +0200 |
---|---|---|
committer | Marcel Klehr <mklehr@gmx.net> | 2023-08-09 10:00:24 +0200 |
commit | dd7eafaa48842857b95edfb24f27f077bf58f200 (patch) | |
tree | c582e8d3fd4a352f95ecf83c0d9ad2f735ab71b0 /lib/public | |
parent | 612af73d92a25c9fbc6a89681172c4ead5f37725 (diff) | |
download | nextcloud-server-dd7eafaa48842857b95edfb24f27f077bf58f200.tar.gz nextcloud-server-dd7eafaa48842857b95edfb24f27f077bf58f200.zip |
LLM OCP API: Fix coding style and psalm
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
(cherry picked from commit 72ea76178a694b302ece8a0752bbf5a22afc637a)
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/LanguageModel/Events/TaskFailedEvent.php | 5 | ||||
-rw-r--r-- | lib/public/LanguageModel/Events/TaskSuccessfulEvent.php | 4 | ||||
-rw-r--r-- | lib/public/LanguageModel/FreePromptTask.php | 3 | ||||
-rw-r--r-- | lib/public/LanguageModel/HeadlineTask.php | 15 | ||||
-rw-r--r-- | lib/public/LanguageModel/ILanguageModelManager.php | 3 | ||||
-rw-r--r-- | lib/public/LanguageModel/SummaryTask.php | 3 | ||||
-rw-r--r-- | lib/public/LanguageModel/TopicsTask.php | 3 |
7 files changed, 31 insertions, 5 deletions
diff --git a/lib/public/LanguageModel/Events/TaskFailedEvent.php b/lib/public/LanguageModel/Events/TaskFailedEvent.php index 5425368d57d..efc7d9043c8 100644 --- a/lib/public/LanguageModel/Events/TaskFailedEvent.php +++ b/lib/public/LanguageModel/Events/TaskFailedEvent.php @@ -8,6 +8,11 @@ use OCP\LanguageModel\ILanguageModelTask; * @since 28.0.0 */ class TaskFailedEvent extends AbstractLanguageModelEvent { + /** + * @param ILanguageModelTask $task + * @param string $errorMessage + * @since 28.0.0 + */ public function __construct(ILanguageModelTask $task, private string $errorMessage) { parent::__construct($task); diff --git a/lib/public/LanguageModel/Events/TaskSuccessfulEvent.php b/lib/public/LanguageModel/Events/TaskSuccessfulEvent.php index 35b5a043215..ec8a8586a3e 100644 --- a/lib/public/LanguageModel/Events/TaskSuccessfulEvent.php +++ b/lib/public/LanguageModel/Events/TaskSuccessfulEvent.php @@ -8,6 +8,10 @@ use OCP\LanguageModel\ILanguageModelTask; * @since 28.0.0 */ class TaskSuccessfulEvent extends AbstractLanguageModelEvent { + /** + * @param ILanguageModelTask $task + * @since 28.0.0 + */ public function __construct(ILanguageModelTask $task) { parent::__construct($task); } diff --git a/lib/public/LanguageModel/FreePromptTask.php b/lib/public/LanguageModel/FreePromptTask.php index 180d778b34c..02eb6803276 100644 --- a/lib/public/LanguageModel/FreePromptTask.php +++ b/lib/public/LanguageModel/FreePromptTask.php @@ -13,6 +13,7 @@ final class FreePromptTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function visitProvider(ILanguageModelProvider $provider): string { return $provider->prompt($this->getInput()); @@ -20,6 +21,7 @@ final class FreePromptTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function canUseProvider(ILanguageModelProvider $provider): bool { return true; @@ -27,6 +29,7 @@ final class FreePromptTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function getType(): string { return self::TYPE; diff --git a/lib/public/LanguageModel/HeadlineTask.php b/lib/public/LanguageModel/HeadlineTask.php index 283af6657e8..fadaea0b92d 100644 --- a/lib/public/LanguageModel/HeadlineTask.php +++ b/lib/public/LanguageModel/HeadlineTask.php @@ -2,8 +2,6 @@ namespace OCP\LanguageModel; -use RuntimeException; - /** * @since 28.0.0 */ @@ -14,9 +12,8 @@ final class HeadlineTask extends AbstractLanguageModelTask { public const TYPE = 'headline'; /** - * @param ILanguageModelProvider $provider - * @throws RuntimeException - * @return string + * @inheritDoc + * @since 28.0.0 */ public function visitProvider(ILanguageModelProvider $provider): string { if (!$provider instanceof IHeadlineProvider) { @@ -25,10 +22,18 @@ final class HeadlineTask extends AbstractLanguageModelTask { return $provider->findHeadline($this->getInput()); } + /** + * @inheritDoc + * @since 28.0.0 + */ public function canUseProvider(ILanguageModelProvider $provider): bool { return $provider instanceof IHeadlineProvider; } + /** + * @inheritDoc + * @since 28.0.0 + */ public function getType(): string { return self::TYPE; } diff --git a/lib/public/LanguageModel/ILanguageModelManager.php b/lib/public/LanguageModel/ILanguageModelManager.php index 5e3f350df66..80546149a62 100644 --- a/lib/public/LanguageModel/ILanguageModelManager.php +++ b/lib/public/LanguageModel/ILanguageModelManager.php @@ -29,6 +29,9 @@ namespace OCP\LanguageModel; use OCP\PreConditionNotMetException; use RuntimeException; +/** + * @since 28.0.0 + */ interface ILanguageModelManager { /** * @since 28.0.0 diff --git a/lib/public/LanguageModel/SummaryTask.php b/lib/public/LanguageModel/SummaryTask.php index e454404be92..b5a3bd25c4f 100644 --- a/lib/public/LanguageModel/SummaryTask.php +++ b/lib/public/LanguageModel/SummaryTask.php @@ -13,6 +13,7 @@ final class SummaryTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function visitProvider(ILanguageModelProvider $provider): string { if (!$provider instanceof ISummaryProvider) { @@ -23,6 +24,7 @@ final class SummaryTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function canUseProvider(ILanguageModelProvider $provider): bool { return $provider instanceof ISummaryProvider; @@ -30,6 +32,7 @@ final class SummaryTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function getType(): string { return self::TYPE; diff --git a/lib/public/LanguageModel/TopicsTask.php b/lib/public/LanguageModel/TopicsTask.php index 114c3c0ab06..a7a29603362 100644 --- a/lib/public/LanguageModel/TopicsTask.php +++ b/lib/public/LanguageModel/TopicsTask.php @@ -13,6 +13,7 @@ final class TopicsTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function visitProvider(ILanguageModelProvider $provider): string { if (!$provider instanceof ITopicsProvider) { @@ -23,6 +24,7 @@ final class TopicsTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function canUseProvider(ILanguageModelProvider $provider): bool { return $provider instanceof ITopicsProvider; @@ -30,6 +32,7 @@ final class TopicsTask extends AbstractLanguageModelTask { /** * @inheritDoc + * @since 28.0.0 */ public function getType(): string { return self::TYPE; |