IProvider.php 946 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\TextProcessing;
  8. use RuntimeException;
  9. /**
  10. * This is the interface that is implemented by apps that
  11. * implement a text processing provider
  12. * @psalm-template-covariant T of ITaskType
  13. * @since 27.1.0
  14. */
  15. interface IProvider {
  16. /**
  17. * The localized name of this provider
  18. * @since 27.1.0
  19. */
  20. public function getName(): string;
  21. /**
  22. * Processes a text
  23. *
  24. * @param string $prompt The input text
  25. * @return string the output text
  26. * @since 27.1.0
  27. * @throws RuntimeException If the text could not be processed
  28. */
  29. public function process(string $prompt): string;
  30. /**
  31. * Returns the task type class string of the task type, that this
  32. * provider handles
  33. *
  34. * @since 27.1.0
  35. * @return class-string<T>
  36. */
  37. public function getTaskType(): string;
  38. }