nextcloud/lib/public/LanguageModel/TopicsTask.php
Marcel Klehr fac83ce4b6 LLM OCP API: Fix static analysis
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2023-07-07 13:39:10 +02:00

39 lines
738 B
PHP

<?php
namespace OCP\LanguageModel;
use RuntimeException;
/**
* @since 28.0.0
*/
final class TopicsTask extends AbstractLanguageModelTask {
/**
* @since 28.0.0
*/
public const TYPE = 'topics';
/**
* @inheritDoc
*/
public function visitProvider(ILanguageModelProvider $provider): string {
if (!$provider instanceof ITopicsProvider) {
throw new \RuntimeException('SummaryTask#visitProvider expects IHeadlineProvider');
}
return $provider->findTopics($this->getInput());
}
/**
* @inheritDoc
*/
public function canUseProvider(ILanguageModelProvider $provider): bool {
return $provider instanceof ITopicsProvider;
}
/**
* @inheritDoc
*/
public function getType(): string {
return self::TYPE;
}
}