diff options
-rw-r--r-- | lib/private/LanguageModel/LanguageModelManager.php | 6 | ||||
-rw-r--r-- | lib/public/LanguageModel/ILanguageModelManager.php | 2 | ||||
-rw-r--r-- | tests/lib/LanguageModel/LanguageModelManagerTest.php | 12 |
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/private/LanguageModel/LanguageModelManager.php b/lib/private/LanguageModel/LanguageModelManager.php index 3b27fbae5ac..11154849c42 100644 --- a/lib/private/LanguageModel/LanguageModelManager.php +++ b/lib/private/LanguageModel/LanguageModelManager.php @@ -102,7 +102,7 @@ class LanguageModelManager implements ILanguageModelManager { /** * @inheritDoc */ - public function getAvailableTasks(): array { + public function getAvailableTaskClasses(): array { $tasks = []; foreach ($this->getProviders() as $provider) { $tasks[FreePromptTask::class] = true; @@ -123,11 +123,11 @@ class LanguageModelManager implements ILanguageModelManager { * @inheritDoc */ public function getAvailableTaskTypes(): array { - return array_map(fn ($taskClass) => $taskClass::TYPE, $this->getAvailableTasks()); + return array_map(fn ($taskClass) => $taskClass::TYPE, $this->getAvailableTaskClasses()); } public function canHandleTask(ILanguageModelTask $task): bool { - return count(array_filter($this->getAvailableTasks(), fn ($class) => $task instanceof $class)) > 0; + return count(array_filter($this->getAvailableTaskClasses(), fn ($class) => $task instanceof $class)) > 0; } /** diff --git a/lib/public/LanguageModel/ILanguageModelManager.php b/lib/public/LanguageModel/ILanguageModelManager.php index 055fb69820f..438ed1ceb00 100644 --- a/lib/public/LanguageModel/ILanguageModelManager.php +++ b/lib/public/LanguageModel/ILanguageModelManager.php @@ -45,7 +45,7 @@ interface ILanguageModelManager { * @return string[] * @since 28.0.0 */ - public function getAvailableTasks(): array; + public function getAvailableTaskClasses(): array; /** * @return string[] diff --git a/tests/lib/LanguageModel/LanguageModelManagerTest.php b/tests/lib/LanguageModel/LanguageModelManagerTest.php index 423eb525ba2..1eea6bf2074 100644 --- a/tests/lib/LanguageModel/LanguageModelManagerTest.php +++ b/tests/lib/LanguageModel/LanguageModelManagerTest.php @@ -163,7 +163,7 @@ class LanguageModelManagerTest extends \Test\TestCase { public function testShouldNotHaveAnyProviders() { $this->registrationContext->expects($this->any())->method('getLanguageModelProviders')->willReturn([]); - $this->assertCount(0, $this->languageModelManager->getAvailableTasks()); + $this->assertCount(0, $this->languageModelManager->getAvailableTaskClasses()); $this->assertCount(0, $this->languageModelManager->getAvailableTaskTypes()); $this->assertFalse($this->languageModelManager->hasProviders()); $this->expectException(PreConditionNotMetException::class); @@ -174,7 +174,7 @@ class LanguageModelManagerTest extends \Test\TestCase { $this->registrationContext->expects($this->any())->method('getLanguageModelProviders')->willReturn([ new ServiceRegistration('test', TestVanillaLanguageModelProvider::class) ]); - $this->assertCount(1, $this->languageModelManager->getAvailableTasks()); + $this->assertCount(1, $this->languageModelManager->getAvailableTaskClasses()); $this->assertCount(1, $this->languageModelManager->getAvailableTaskTypes()); $this->assertTrue($this->languageModelManager->hasProviders()); $this->assertEquals('Hello Free Prompt', $this->languageModelManager->runTask(new FreePromptTask('Hello', 'test', null))); @@ -189,7 +189,7 @@ class LanguageModelManagerTest extends \Test\TestCase { $this->registrationContext->expects($this->any())->method('getLanguageModelProviders')->willReturn([ new ServiceRegistration('test', TestVanillaLanguageModelProvider::class) ]); - $this->assertCount(1, $this->languageModelManager->getAvailableTasks()); + $this->assertCount(1, $this->languageModelManager->getAvailableTaskClasses()); $this->assertCount(1, $this->languageModelManager->getAvailableTaskTypes()); $this->assertTrue($this->languageModelManager->hasProviders()); @@ -259,7 +259,7 @@ class LanguageModelManagerTest extends \Test\TestCase { new ServiceRegistration('test', TestVanillaLanguageModelProvider::class), new ServiceRegistration('test', TestFullLanguageModelProvider::class), ]); - $this->assertCount(3, $this->languageModelManager->getAvailableTasks()); + $this->assertCount(3, $this->languageModelManager->getAvailableTaskClasses()); $this->assertCount(3, $this->languageModelManager->getAvailableTaskTypes()); $this->assertTrue($this->languageModelManager->hasProviders()); @@ -287,7 +287,7 @@ class LanguageModelManagerTest extends \Test\TestCase { $this->registrationContext->expects($this->any())->method('getLanguageModelProviders')->willReturn([ new ServiceRegistration('test', TestFailingLanguageModelProvider::class), ]); - $this->assertCount(1, $this->languageModelManager->getAvailableTasks()); + $this->assertCount(1, $this->languageModelManager->getAvailableTaskClasses()); $this->assertCount(1, $this->languageModelManager->getAvailableTaskTypes()); $this->assertTrue($this->languageModelManager->hasProviders()); @@ -354,7 +354,7 @@ class LanguageModelManagerTest extends \Test\TestCase { $this->registrationContext->expects($this->any())->method('getLanguageModelProviders')->willReturn([ new ServiceRegistration('test', TestVanillaLanguageModelProvider::class) ]); - $this->assertCount(1, $this->languageModelManager->getAvailableTasks()); + $this->assertCount(1, $this->languageModelManager->getAvailableTaskClasses()); $this->assertCount(1, $this->languageModelManager->getAvailableTaskTypes()); $this->assertTrue($this->languageModelManager->hasProviders()); $task = new FreePromptTask('Hello', 'test', null); |