mirror of
https://github.com/nextcloud/server.git
synced 2026-07-05 12:34:39 +02:00
9d5717d239
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
30 lines
713 B
PHP
30 lines
713 B
PHP
<?php
|
|
|
|
namespace OCP\LanguageModel;
|
|
|
|
use RuntimeException;
|
|
|
|
final class SummaryTask extends AbstractLanguageModelTask {
|
|
public const TYPE = 'summarize';
|
|
|
|
/**
|
|
* @param ILanguageModelProvider $provider
|
|
* @throws RuntimeException
|
|
* @return string
|
|
*/
|
|
public function visitProvider(ILanguageModelProvider $provider): string {
|
|
if (!$provider instanceof ISummaryProvider) {
|
|
throw new \RuntimeException('SummaryTask#visitProvider expects ISummaryProvider');
|
|
}
|
|
return $provider->summarize($this->getInput());
|
|
}
|
|
|
|
public function canUseProvider(ILanguageModelProvider $provider): bool {
|
|
return $provider instanceof ISummaryProvider;
|
|
}
|
|
|
|
public function getType(): string {
|
|
return self::TYPE;
|
|
}
|
|
}
|