mirror of
https://github.com/nextcloud/server.git
synced 2026-02-15 08:48:14 -05:00
42 lines
887 B
PHP
42 lines
887 B
PHP
<?php
|
|
|
|
namespace OCP\LanguageModel;
|
|
|
|
/**
|
|
* This LanguageModel Task represents headline generation
|
|
* which generates a headline for the passed text
|
|
* @since 28.0.0
|
|
*/
|
|
final class HeadlineTask extends AbstractLanguageModelTask {
|
|
/**
|
|
* @since 28.0.0
|
|
*/
|
|
public const TYPE = 'headline';
|
|
|
|
/**
|
|
* @inheritDoc
|
|
* @since 28.0.0
|
|
*/
|
|
public function visitProvider(ILanguageModelProvider $provider): string {
|
|
if (!$provider instanceof IHeadlineProvider) {
|
|
throw new \RuntimeException('SummaryTask#visitProvider expects IHeadlineProvider');
|
|
}
|
|
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;
|
|
}
|
|
}
|