Skip to content

Commit 65c5429

Browse files
committed
Rewrite interfaces to implement them properly
1 parent c3c934f commit 65c5429

File tree

6 files changed

+10
-47
lines changed

6 files changed

+10
-47
lines changed

src/Interface/ImageInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function generateImage(string $prompt, array $options = []): Response;
3939
* @return Response
4040
* @since __DEPLOY_VERSION__
4141
*/
42-
// public function editImage(string $imagePath, string $prompt, array $options = []): Response;
42+
public function editImage(string $imagePath, string $prompt, array $options = []): Response;
4343

4444
/**
4545
* Create alternative versions of an image from the text prompt given to the AI provider.
@@ -50,5 +50,5 @@ public function generateImage(string $prompt, array $options = []): Response;
5050
* @return Response
5151
* @since __DEPLOY_VERSION__
5252
*/
53-
// public function createImageVariations(string $imagePath, array $options = []): Response;
53+
public function createImageVariation(string $imagePath, array $options = []): Response;
5454
}

src/Interface/ModelInterface.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,38 +16,6 @@
1616
*/
1717
interface ModelInterface
1818
{
19-
/**
20-
* Get all available models for this provider.
21-
*
22-
* @return array Array of available model names
23-
* @since __DEPLOY_VERSION__
24-
*/
25-
public function getAvailableModels(): array;
26-
27-
/**
28-
* Get models that support chat capability.
29-
*
30-
* @return array Array of chat capable model names
31-
* @since __DEPLOY_VERSION__
32-
*/
33-
public function getChatModels(): array;
34-
35-
/**
36-
* Get models that support vision capability.
37-
*
38-
* @return array Array of vision capable model names
39-
* @since __DEPLOY_VERSION__
40-
*/
41-
public function getVisionModels(): array;
42-
43-
/**
44-
* Get models that support image generation capability.
45-
*
46-
* @return array Array of image capable model names
47-
* @since __DEPLOY_VERSION__
48-
*/
49-
// public function getImageModels(): array;
50-
5119
/**
5220
* Check if a model supports a specific capability.
5321
*

src/Interface/ProviderInterface.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
namespace Joomla\AI\Interface;
1111

12-
use Joomla\AI\Response\Response;
13-
1412
/**
1513
* AI provider class interface.
1614
*
@@ -34,15 +32,11 @@ public static function isSupported(): bool;
3432
*/
3533
public function getName(): string;
3634

37-
// Should be a smart router in future versions.
3835
/**
39-
* Send a prompt to the AI provider and return a Response object with the response.
40-
*
41-
* @param string $prompt The prompt to send to the AI provider.
42-
* @param array $options An associative array of options to send with the request.
36+
* Get all available models for this provider.
4337
*
44-
* @return Response
45-
* @since __DEPLOY_VERSION__
38+
* @return array Array of available model names
39+
* @since __DEPLOY_VERSION__
4640
*/
47-
// public function prompt(string $prompt, array $options = []): Response;
41+
public function getAvailableModels(): array;
4842
}

src/Provider/AnthropicProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
namespace Joomla\AI\Provider;
1111

1212
use Joomla\AI\AbstractProvider;
13-
use Joomla\AI\Provider\OpenAIProvider;
1413
use Joomla\AI\Exception\AuthenticationException;
1514
use Joomla\AI\Exception\InvalidArgumentException;
1615
use Joomla\AI\Exception\ProviderException;

src/Provider/OllamaProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Joomla\AI\Exception\AuthenticationException;
77
use Joomla\AI\Exception\InvalidArgumentException;
88
use Joomla\AI\Exception\ProviderException;
9+
use Joomla\AI\Interface\ProviderInterface;
910
use Joomla\AI\Response\Response;
1011
use Joomla\Http\HttpFactory;
1112

@@ -14,7 +15,7 @@
1415
*
1516
* @since __DEPLOY_VERSION__
1617
*/
17-
class OllamaProvider extends AbstractProvider
18+
class OllamaProvider extends AbstractProvider implements ProviderInterface
1819
{
1920
/**
2021
* Custom base URL for API requests

src/Provider/OpenAIProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Joomla\AI\Exception\AuthenticationException;
1414
use Joomla\AI\Exception\InvalidArgumentException;
1515
use Joomla\AI\Exception\ProviderException;
16+
use Joomla\AI\Interface\ProviderInterface;
1617
use Joomla\AI\Interface\AudioInterface;
1718
use Joomla\AI\Interface\ChatInterface;
1819
use Joomla\AI\Interface\ImageInterface;
@@ -26,7 +27,7 @@
2627
*
2728
* @since __DEPLOY_VERSION__
2829
*/
29-
class OpenAIProvider extends AbstractProvider implements ChatInterface, ModelInterface, ImageInterface, AudioInterface, ModerationInterface
30+
class OpenAIProvider extends AbstractProvider implements ProviderInterface, ChatInterface, ModelInterface, ImageInterface, AudioInterface, ModerationInterface
3031
{
3132
/**
3233
* Custom base URL for API requests

0 commit comments

Comments
 (0)