update 2023-07-04 07:26:00
This commit is contained in:
parent
ffb790120f
commit
09bbac5d76
75
README.md
75
README.md
@ -1,74 +1 @@
|
||||
```
|
||||
███████╗██╗ ██╗██████╗ ███████╗██████╗
|
||||
██╔════╝██║ ██║██╔══██╗██╔════╝██╔══██╗
|
||||
███████╗██║ ██║██████╔╝█████╗ ██████╔╝
|
||||
╚════██║██║ ██║██╔═══╝ ██╔══╝ ██╔══██╗
|
||||
███████║╚██████╔╝██║ ███████╗██║ ██║
|
||||
╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗██╔════╝
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝███████╗
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗╚════██║
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║███████║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝
|
||||
```
|
||||
|
||||
### What is JCB Super Powers?
|
||||
The Joomla Component Builder (JCB) Super Power features are designed to enhance JCB's functionality and streamline the development process. These Super Powers enable developers to efficiently manage and share their custom powers across multiple JCB instances through repositories hosted on [https://git.vdm.dev/[username]/[repository-name]](https://git.vdm.dev). JCB Super Powers are managed using a combination of layers, events, tasks, methods, switches, and algorithms, which work together to provide powerful customization and extensibility options. More details on JCB Super Powers can be found in the [Super Powers Documentation](https://git.vdm.dev/joomla/super-powers/wiki).
|
||||
|
||||
In summary, JCB Super Powers offer a flexible and efficient way to manage and share functionalities between JCB instances. By utilizing a sophisticated system of layers, events, tasks, methods, switches, and algorithms, developers can seamlessly integrate JCB core powers and their custom powers. For more information on how to work with JCB Super Powers, refer to the [Super Powers User Guide](https://git.vdm.dev/joomla/super-powers/wiki).
|
||||
|
||||
### What can I find here?
|
||||
This repository contains an index (see below) of all the approved powers within the JCB GUI. During the compilation of a component, these powers are automatically added to the repository, ensuring a well-organized and accessible collection of functionalities.
|
||||
|
||||
# Index of powers
|
||||
|
||||
- **Namespace**: [VDM\Joomla\Openai](#vdm-joomla-openai)
|
||||
|
||||
- **abstract class Factory** | [Details](src/d78bee89-6f7e-42b6-917e-17f05b238490) | [Code](src/d78bee89-6f7e-42b6-917e-17f05b238490/code.php) | [Settings](src/d78bee89-6f7e-42b6-917e-17f05b238490/settings.json) | Super__d78bee89_6f7e_42b6_917e_17f05b238490__Power
|
||||
- **class Audio** | [Details](src/d76b2e22-c8dd-44b1-86b5-822768b317a3) | [Code](src/d76b2e22-c8dd-44b1-86b5-822768b317a3/code.php) | [Settings](src/d76b2e22-c8dd-44b1-86b5-822768b317a3/settings.json) | Super__d76b2e22_c8dd_44b1_86b5_822768b317a3__Power
|
||||
- **class Chat** | [Details](src/c54c92da-2dd7-4136-81c9-1785f2fa0af5) | [Code](src/c54c92da-2dd7-4136-81c9-1785f2fa0af5/code.php) | [Settings](src/c54c92da-2dd7-4136-81c9-1785f2fa0af5/settings.json) | Super__c54c92da_2dd7_4136_81c9_1785f2fa0af5__Power
|
||||
- **class Completions** | [Details](src/796cca70-2577-4f8f-9a05-ac37db1f2f02) | [Code](src/796cca70-2577-4f8f-9a05-ac37db1f2f02/code.php) | [Settings](src/796cca70-2577-4f8f-9a05-ac37db1f2f02/settings.json) | Super__796cca70_2577_4f8f_9a05_ac37db1f2f02__Power
|
||||
- **class Edits** | [Details](src/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8) | [Code](src/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8/code.php) | [Settings](src/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8/settings.json) | Super__98e59bdf_81a2_41ef_a3a6_6a88a7cc53c8__Power
|
||||
- **class Embeddings** | [Details](src/df141f03-393f-4fa3-a568-8b65f7358b02) | [Code](src/df141f03-393f-4fa3-a568-8b65f7358b02/code.php) | [Settings](src/df141f03-393f-4fa3-a568-8b65f7358b02/settings.json) | Super__df141f03_393f_4fa3_a568_8b65f7358b02__Power
|
||||
- **class Files** | [Details](src/65dd022b-8f3a-46be-8930-0cae74b9834b) | [Code](src/65dd022b-8f3a-46be-8930-0cae74b9834b/code.php) | [Settings](src/65dd022b-8f3a-46be-8930-0cae74b9834b/settings.json) | Super__65dd022b_8f3a_46be_8930_0cae74b9834b__Power
|
||||
- **class FineTunes** | [Details](src/0e61da13-6429-426d-a6f9-f5723cd3b7b1) | [Code](src/0e61da13-6429-426d-a6f9-f5723cd3b7b1/code.php) | [Settings](src/0e61da13-6429-426d-a6f9-f5723cd3b7b1/settings.json) | Super__0e61da13_6429_426d_a6f9_f5723cd3b7b1__Power
|
||||
- **class Images** | [Details](src/bb8973c1-261f-4b55-8f9b-9ee98843fced) | [Code](src/bb8973c1-261f-4b55-8f9b-9ee98843fced/code.php) | [Settings](src/bb8973c1-261f-4b55-8f9b-9ee98843fced/settings.json) | Super__bb8973c1_261f_4b55_8f9b_9ee98843fced__Power
|
||||
- **class Models** | [Details](src/08abd2df-1406-4939-a1a6-94d2fce3f043) | [Code](src/08abd2df-1406-4939-a1a6-94d2fce3f043/code.php) | [Settings](src/08abd2df-1406-4939-a1a6-94d2fce3f043/settings.json) | Super__08abd2df_1406_4939_a1a6_94d2fce3f043__Power
|
||||
- **class Moderate** | [Details](src/34f2c249-64a7-4229-9592-77e58f6e994f) | [Code](src/34f2c249-64a7-4229-9592-77e58f6e994f/code.php) | [Settings](src/34f2c249-64a7-4229-9592-77e58f6e994f/settings.json) | Super__34f2c249_64a7_4229_9592_77e58f6e994f__Power
|
||||
- **Namespace**: [VDM\Joomla\Openai\Abstraction](#vdm-joomla-openai-abstraction)
|
||||
|
||||
- **abstract class Api** | [Details](src/585de711-2784-4f89-90bf-94a8a63366f1) | [Code](src/585de711-2784-4f89-90bf-94a8a63366f1/code.php) | [Settings](src/585de711-2784-4f89-90bf-94a8a63366f1/settings.json) | Super__585de711_2784_4f89_90bf_94a8a63366f1__Power
|
||||
- **Namespace**: [VDM\Joomla\Openai\Service](#vdm-joomla-openai-service)
|
||||
|
||||
- **class Api** | [Details](src/ccf3141a-929d-4466-b122-9ace2eea8d70) | [Code](src/ccf3141a-929d-4466-b122-9ace2eea8d70/code.php) | [Settings](src/ccf3141a-929d-4466-b122-9ace2eea8d70/settings.json) | Super__ccf3141a_929d_4466_b122_9ace2eea8d70__Power
|
||||
- **class Utilities** | [Details](src/07858e1f-5698-4227-8941-03dc93557938) | [Code](src/07858e1f-5698-4227-8941-03dc93557938/code.php) | [Settings](src/07858e1f-5698-4227-8941-03dc93557938/settings.json) | Super__07858e1f_5698_4227_8941_03dc93557938__Power
|
||||
- **Namespace**: [VDM\Joomla\Openai\Utilities](#vdm-joomla-openai-utilities)
|
||||
|
||||
- **final class Http** | [Details](src/4c58b254-aea5-40aa-b54d-9586a1690451) | [Code](src/4c58b254-aea5-40aa-b54d-9586a1690451/code.php) | [Settings](src/4c58b254-aea5-40aa-b54d-9586a1690451/settings.json) | Super__4c58b254_aea5_40aa_b54d_9586a1690451__Power
|
||||
- **final class Response** | [Details](src/c464393e-7606-406e-8463-a86774590966) | [Code](src/c464393e-7606-406e-8463-a86774590966/code.php) | [Settings](src/c464393e-7606-406e-8463-a86774590966/settings.json) | Super__c464393e_7606_406e_8463_a86774590966__Power
|
||||
- **final class Uri** | [Details](src/13ef84f4-25b0-43dd-a9f6-0722abf220c1) | [Code](src/13ef84f4-25b0-43dd-a9f6-0722abf220c1/code.php) | [Settings](src/13ef84f4-25b0-43dd-a9f6-0722abf220c1/settings.json) | Super__13ef84f4_25b0_43dd_a9f6_0722abf220c1__Power
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗
|
||||
██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗
|
||||
██║██║ ██║██║ ██║██╔████╔██║██║ ███████║
|
||||
██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║
|
||||
╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║
|
||||
╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
|
||||
██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗
|
||||
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝
|
||||
██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║
|
||||
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║
|
||||
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║
|
||||
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝
|
||||
██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗
|
||||
██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝
|
||||
██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗
|
||||
██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║
|
||||
╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -1,61 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Utilities (Details)
|
||||
> namespace: **VDM\Joomla\Openai\Service**
|
||||
```uml
|
||||
@startuml
|
||||
class Utilities #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getUri(Container $container) : Uri
|
||||
+ getResponse(Container $container) : Response
|
||||
+ getHttp(Container $container) : Http
|
||||
}
|
||||
|
||||
note right of Utilities::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Utilities::getUri
|
||||
Get the Uri class
|
||||
|
||||
since: 3.2.0
|
||||
return: Uri
|
||||
end note
|
||||
|
||||
note right of Utilities::getResponse
|
||||
Get the Response class
|
||||
|
||||
since: 3.2.0
|
||||
return: Response
|
||||
end note
|
||||
|
||||
note right of Utilities::getHttp
|
||||
Get the Http class
|
||||
|
||||
since: 3.2.0
|
||||
return: Http
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,84 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Openai\Utilities\Uri;
|
||||
use VDM\Joomla\Openai\Utilities\Response;
|
||||
use VDM\Joomla\Openai\Utilities\Http;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Utilities Service
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Utilities implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Uri::class, 'Openai.Utilities.Uri')
|
||||
->share('Openai.Utilities.Uri', [$this, 'getUri'], true);
|
||||
|
||||
$container->alias(Response::class, 'Openai.Utilities.Response')
|
||||
->share('Openai.Utilities.Response', [$this, 'getResponse'], true);
|
||||
|
||||
$container->alias(Http::class, 'Openai.Utilities.Http')
|
||||
->share('Openai.Utilities.Http', [$this, 'getHttp'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Uri class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Uri
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getUri(Container $container): Uri
|
||||
{
|
||||
return new Uri();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Response
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getResponse(Container $container): Response
|
||||
{
|
||||
return new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Http class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Http
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getHttp(Container $container): Http
|
||||
{
|
||||
return new Http(
|
||||
Helper::getParams()->get('openai_token'),
|
||||
Helper::getParams()->get('openai_org_token')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,61 +1 @@
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Uri::class, 'Openai.Utilities.Uri')
|
||||
->share('Openai.Utilities.Uri', [$this, 'getUri'], true);
|
||||
|
||||
$container->alias(Response::class, 'Openai.Utilities.Response')
|
||||
->share('Openai.Utilities.Response', [$this, 'getResponse'], true);
|
||||
|
||||
$container->alias(Http::class, 'Openai.Utilities.Http')
|
||||
->share('Openai.Utilities.Http', [$this, 'getHttp'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Uri class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Uri
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getUri(Container $container): Uri
|
||||
{
|
||||
return new Uri();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Response class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Response
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getResponse(Container $container): Response
|
||||
{
|
||||
return new Response();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Http class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Http
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function getHttp(Container $container): Http
|
||||
{
|
||||
return new Http(
|
||||
Helper::getParams()->get('openai_token'),
|
||||
Helper::getParams()->get('openai_org_token')
|
||||
);
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,38 +1 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "07858e1f-5698-4227-8941-03dc93557938",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Utilities",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Service.Utilities",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "13ef84f4-25b0-43dd-a9f6-0722abf220c1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "c464393e-7606-406e-8463-a86774590966",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "4c58b254-aea5-40aa-b54d-9586a1690451",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Openai\\Service.Utilities",
|
||||
"description": "The Openai Utilities Service\r\n\r\n@since 3.2.0",
|
||||
"implements_custom": "ServiceProviderInterface",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,37 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Models (Details)
|
||||
> namespace: **VDM\Joomla\Openai**
|
||||
```uml
|
||||
@startuml
|
||||
class Models #Gold {
|
||||
+ list() : ?object
|
||||
}
|
||||
|
||||
note right of Models::list
|
||||
List the available models from OpenAI API.
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,36 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai;
|
||||
|
||||
|
||||
use VDM\Joomla\Openai\Abstraction\Api;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Models
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Models extends Api
|
||||
{
|
||||
/**
|
||||
* List the available models from OpenAI API.
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function list(): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/models";
|
||||
|
||||
// Send the get request.
|
||||
return $this->response->get(
|
||||
$this->http->get(
|
||||
$this->uri->get($path)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,18 +1 @@
|
||||
/**
|
||||
* List the available models from OpenAI API.
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function list(): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/models";
|
||||
|
||||
// Send the get request.
|
||||
return $this->response->get(
|
||||
$this->http->get(
|
||||
$this->uri->get($path)
|
||||
)
|
||||
);
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,18 +1 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "585de711-2784-4f89-90bf-94a8a63366f1",
|
||||
"guid": "08abd2df-1406-4939-a1a6-94d2fce3f043",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Models",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Models",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Openai\\Models",
|
||||
"description": "The Openai Models\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,74 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Uri (Details)
|
||||
> namespace: **VDM\Joomla\Openai\Utilities**
|
||||
```uml
|
||||
@startuml
|
||||
class Uri << (F,LightGreen) >> #Green {
|
||||
- string $version
|
||||
- string $url
|
||||
+ __construct(string $url = 'https://api.openai.com', string $version = 'v1')
|
||||
+ get(string $path) : JoomlaUri
|
||||
+ api() : string
|
||||
- setUrl(string $url) : void
|
||||
- setVersion(string $version) : void
|
||||
}
|
||||
|
||||
note right of Uri::__construct
|
||||
Constructor
|
||||
example: https://api.openai.com
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
note right of Uri::get
|
||||
Method to build and return a full request URL for the request. This method will
|
||||
add appropriate pagination details if necessary and also prepend the API url
|
||||
to have a complete URL for the request.
|
||||
|
||||
since: 3.2.0
|
||||
return: JoomlaUri
|
||||
end note
|
||||
|
||||
note right of Uri::api
|
||||
Get the full API URL
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Uri::setUrl
|
||||
Set the URL of the API
|
||||
example: https://api.openai.com
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Uri::setVersion
|
||||
Set the version of the API
|
||||
|
||||
since: 3.2.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,107 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai\Utilities;
|
||||
|
||||
|
||||
use Joomla\Uri\Uri as JoomlaUri;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Uri
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class Uri
|
||||
{
|
||||
/**
|
||||
* The api version
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private string $version;
|
||||
|
||||
/**
|
||||
* The api URL
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private string $url;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $url URL to the openai system
|
||||
* example: https://api.openai.com
|
||||
* @param string $version Version to the openai system
|
||||
*
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function __construct(
|
||||
string $url = 'https://api.openai.com',
|
||||
string $version = 'v1')
|
||||
{
|
||||
// set the API details
|
||||
$this->setUrl($url);
|
||||
$this->setVersion($version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build and return a full request URL for the request. This method will
|
||||
* add appropriate pagination details if necessary and also prepend the API url
|
||||
* to have a complete URL for the request.
|
||||
*
|
||||
* @param string $path URL to inflect
|
||||
*
|
||||
* @return JoomlaUri
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function get(string $path): JoomlaUri
|
||||
{
|
||||
// Get a new Uri object focusing the api url and given path.
|
||||
$uri = new JoomlaUri($this->api() . $path);
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full API URL
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function api(): string
|
||||
{
|
||||
return $this->url . '/' . $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URL of the API
|
||||
*
|
||||
* @param string $url URL to your openai system
|
||||
* example: https://api.openai.com
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private function setUrl(string $url)
|
||||
{
|
||||
return $this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the version of the API
|
||||
*
|
||||
* @param string $version version to your openai API
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private function setVersion($version)
|
||||
{
|
||||
return $this->version = $version;
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,89 +1 @@
|
||||
/**
|
||||
* The api version
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private string $version;
|
||||
|
||||
/**
|
||||
* The api URL
|
||||
*
|
||||
* @var string
|
||||
* @since 3.2.0
|
||||
*/
|
||||
private string $url;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $url URL to the openai system
|
||||
* example: https://api.openai.com
|
||||
* @param string $version Version to the openai system
|
||||
*
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function __construct(
|
||||
string $url = 'https://api.openai.com',
|
||||
string $version = 'v1')
|
||||
{
|
||||
// set the API details
|
||||
$this->setUrl($url);
|
||||
$this->setVersion($version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to build and return a full request URL for the request. This method will
|
||||
* add appropriate pagination details if necessary and also prepend the API url
|
||||
* to have a complete URL for the request.
|
||||
*
|
||||
* @param string $path URL to inflect
|
||||
*
|
||||
* @return JoomlaUri
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function get(string $path): JoomlaUri
|
||||
{
|
||||
// Get a new Uri object focusing the api url and given path.
|
||||
$uri = new JoomlaUri($this->api() . $path);
|
||||
|
||||
return $uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full API URL
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function api(): string
|
||||
{
|
||||
return $this->url . '/' . $this->version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the URL of the API
|
||||
*
|
||||
* @param string $url URL to your openai system
|
||||
* example: https://api.openai.com
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private function setUrl(string $url)
|
||||
{
|
||||
return $this->url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the version of the API
|
||||
*
|
||||
* @param string $version version to your openai API
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.0
|
||||
**/
|
||||
private function setVersion($version)
|
||||
{
|
||||
return $this->version = $version;
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,18 +1 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "13ef84f4-25b0-43dd-a9f6-0722abf220c1",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Uri",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Utilities.Uri",
|
||||
"type": "final class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Openai\\Utilities.Uri",
|
||||
"description": "The Openai Uri\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\Uri\\Uri as JoomlaUri;",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,38 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Moderate (Details)
|
||||
> namespace: **VDM\Joomla\Openai**
|
||||
```uml
|
||||
@startuml
|
||||
class Moderate #Gold {
|
||||
+ text(string|array $input, ?string $model = null) : ?object
|
||||
}
|
||||
|
||||
note right of Moderate::text
|
||||
Classify if text violates OpenAI's Content Policy.
|
||||
API Ref: https://platform.openai.com/docs/api-reference/moderations/create
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,52 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai;
|
||||
|
||||
|
||||
use VDM\Joomla\Openai\Abstraction\Api;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Moderate
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Moderate extends Api
|
||||
{
|
||||
/**
|
||||
* Classify if text violates OpenAI's Content Policy.
|
||||
* API Ref: https://platform.openai.com/docs/api-reference/moderations/create
|
||||
*
|
||||
* @param string|array $input The input text to classify.
|
||||
* @param string|null $model The moderation model (optional).
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function text(
|
||||
$input,
|
||||
?string $model = null
|
||||
): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/moderations";
|
||||
|
||||
// Set the moderation data.
|
||||
$data = new \stdClass();
|
||||
$data->input = $input;
|
||||
|
||||
if ($model !== null)
|
||||
{
|
||||
$data->model = $model;
|
||||
}
|
||||
|
||||
// Send the post request.
|
||||
return $this->response->get(
|
||||
$this->http->post(
|
||||
$this->uri->get($path), json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,34 +1 @@
|
||||
/**
|
||||
* Classify if text violates OpenAI's Content Policy.
|
||||
* API Ref: https://platform.openai.com/docs/api-reference/moderations/create
|
||||
*
|
||||
* @param string|array $input The input text to classify.
|
||||
* @param string|null $model The moderation model (optional).
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function text(
|
||||
$input,
|
||||
?string $model = null
|
||||
): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/moderations";
|
||||
|
||||
// Set the moderation data.
|
||||
$data = new \stdClass();
|
||||
$data->input = $input;
|
||||
|
||||
if ($model !== null)
|
||||
{
|
||||
$data->model = $model;
|
||||
}
|
||||
|
||||
// Send the post request.
|
||||
return $this->response->get(
|
||||
$this->http->post(
|
||||
$this->uri->get($path), json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,18 +1 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "585de711-2784-4f89-90bf-94a8a63366f1",
|
||||
"guid": "34f2c249-64a7-4229-9592-77e58f6e994f",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Moderate",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Moderate",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Openai\\Moderate",
|
||||
"description": "The Openai Moderate\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,36 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Http (Details)
|
||||
> namespace: **VDM\Joomla\Openai\Utilities**
|
||||
```uml
|
||||
@startuml
|
||||
class Http << (F,LightGreen) >> #Green {
|
||||
+ __construct(?string $token, ?string $org = null)
|
||||
}
|
||||
|
||||
note right of Http::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,55 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Http\Http as JoomlaHttp;
|
||||
use Joomla\Registry\Registry;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Http
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class Http extends JoomlaHttp
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|null $token The Openai API token.
|
||||
* @param string|null $org The Openai API Organization token.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \InvalidArgumentException
|
||||
**/
|
||||
public function __construct(?string $token, ?string $org = null)
|
||||
{
|
||||
// setup config
|
||||
$config = [
|
||||
'userAgent' => 'JoomlaOpenai/3.0',
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json'
|
||||
]
|
||||
];
|
||||
|
||||
// add the token if given
|
||||
if (is_string($token))
|
||||
{
|
||||
$config['headers']['Authorization'] = 'Bearer ' . $token;
|
||||
}
|
||||
|
||||
// add the organization token if given
|
||||
if (is_string($org))
|
||||
{
|
||||
$config['headers']['OpenAI-Organization'] = $org;
|
||||
}
|
||||
|
||||
$options = new Registry($config);
|
||||
|
||||
// run parent constructor
|
||||
parent::__construct($options);
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,36 +1 @@
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|null $token The Openai API token.
|
||||
* @param string|null $org The Openai API Organization token.
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \InvalidArgumentException
|
||||
**/
|
||||
public function __construct(?string $token, ?string $org = null)
|
||||
{
|
||||
// setup config
|
||||
$config = [
|
||||
'userAgent' => 'JoomlaOpenai/3.0',
|
||||
'headers' => [
|
||||
'Content-Type' => 'application/json'
|
||||
]
|
||||
];
|
||||
|
||||
// add the token if given
|
||||
if (is_string($token))
|
||||
{
|
||||
$config['headers']['Authorization'] = 'Bearer ' . $token;
|
||||
}
|
||||
|
||||
// add the organization token if given
|
||||
if (is_string($org))
|
||||
{
|
||||
$config['headers']['OpenAI-Organization'] = $org;
|
||||
}
|
||||
|
||||
$options = new Registry($config);
|
||||
|
||||
// run parent constructor
|
||||
parent::__construct($options);
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,19 +1 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "-1",
|
||||
"guid": "4c58b254-aea5-40aa-b54d-9586a1690451",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Http",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Utilities.Http",
|
||||
"type": "final class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Openai\\Utilities.Http",
|
||||
"description": "The Openai Http\r\n\r\n@since 3.2.0",
|
||||
"extends_custom": "JoomlaHttp",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Http\\Http as JoomlaHttp;\r\nuse Joomla\\Registry\\Registry;",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,44 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# abstract class Api (Details)
|
||||
> namespace: **VDM\Joomla\Openai\Abstraction**
|
||||
```uml
|
||||
@startuml
|
||||
abstract Api #Orange {
|
||||
# Http $http
|
||||
# Uri $uri
|
||||
# Response $response
|
||||
+ __construct(Http $http, Uri $uri, ...)
|
||||
}
|
||||
|
||||
note right of Api::__construct
|
||||
Constructor.
|
||||
|
||||
since: 3.2.0
|
||||
|
||||
arguments:
|
||||
Http $http
|
||||
Uri $uri
|
||||
Response $response
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,59 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai\Abstraction;
|
||||
|
||||
|
||||
use VDM\Joomla\Openai\Utilities\Http;
|
||||
use VDM\Joomla\Openai\Utilities\Uri;
|
||||
use VDM\Joomla\Openai\Utilities\Response;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Api
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
abstract class Api
|
||||
{
|
||||
/**
|
||||
* The Http class
|
||||
*
|
||||
* @var Http
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Http $http;
|
||||
|
||||
/**
|
||||
* The Uri class
|
||||
*
|
||||
* @var Uri
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Uri $uri;
|
||||
|
||||
/**
|
||||
* The Response class
|
||||
*
|
||||
* @var Response
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Response $response;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Http $http The http class.
|
||||
* @param Uri $uri The uri class.
|
||||
* @param Response $response The response class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function __construct(Http $http, Uri $uri, Response $response)
|
||||
{
|
||||
$this->http = $http;
|
||||
$this->uri = $uri;
|
||||
$this->response = $response;
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,39 +1 @@
|
||||
/**
|
||||
* The Http class
|
||||
*
|
||||
* @var Http
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Http $http;
|
||||
|
||||
/**
|
||||
* The Uri class
|
||||
*
|
||||
* @var Uri
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Uri $uri;
|
||||
|
||||
/**
|
||||
* The Response class
|
||||
*
|
||||
* @var Response
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected Response $response;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Http $http The http class.
|
||||
* @param Uri $uri The uri class.
|
||||
* @param Response $response The response class.
|
||||
*
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function __construct(Http $http, Uri $uri, Response $response)
|
||||
{
|
||||
$this->http = $http;
|
||||
$this->uri = $uri;
|
||||
$this->response = $response;
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,31 +1 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "585de711-2784-4f89-90bf-94a8a63366f1",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Api",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Abstraction.Api",
|
||||
"type": "abstract class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "4c58b254-aea5-40aa-b54d-9586a1690451",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "13ef84f4-25b0-43dd-a9f6-0722abf220c1",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "c464393e-7606-406e-8463-a86774590966",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Openai\\Abstraction.Api",
|
||||
"description": "The Openai Api\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,56 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Completions (Details)
|
||||
> namespace: **VDM\Joomla\Openai**
|
||||
```uml
|
||||
@startuml
|
||||
class Completions #Gold {
|
||||
+ create(string $model, string|array $prompt, ...) : ?object
|
||||
}
|
||||
|
||||
note right of Completions::create
|
||||
Create a completion using the OpenAI API.
|
||||
API Ref: https://platform.openai.com/docs/api-reference/completions
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
|
||||
arguments:
|
||||
string $model
|
||||
string|array $prompt
|
||||
?int $maxTokens = null
|
||||
?string $suffix = null
|
||||
?float $temperature = null
|
||||
?float $topP = null
|
||||
?int $n = null
|
||||
?bool $stream = null
|
||||
?int $logprobs = null
|
||||
?bool $echo = null
|
||||
string|null $stop = null
|
||||
?float $presencePenalty = null
|
||||
?float $frequencyPenalty = null
|
||||
?int $bestOf = null
|
||||
?array $logitBias = null
|
||||
?string $user = null
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,150 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai;
|
||||
|
||||
|
||||
use VDM\Joomla\Openai\Abstraction\Api;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Completions
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Completions extends Api
|
||||
{
|
||||
/**
|
||||
* Create a completion using the OpenAI API.
|
||||
* API Ref: https://platform.openai.com/docs/api-reference/completions
|
||||
*
|
||||
* @param string $model The ID of the model to use.
|
||||
* @param string|array $prompt The prompt(s) to generate completions for.
|
||||
* @param int|null $maxTokens The maximum number of tokens to generate (optional).
|
||||
* @param float|null $temperature The sampling temperature to use (optional).
|
||||
* @param string $suffix The suffix that comes after a completion of inserted text. (optional).
|
||||
* @param float|null $topP The top_p value for nucleus sampling (optional).
|
||||
* @param int|null $n How many completions to generate (optional).
|
||||
* @param bool|null $stream Whether to stream back partial progress (optional).
|
||||
* @param int|null $logprobs Include the log probabilities on the most likely tokens (optional).
|
||||
* @param bool|null $echo Echo back the prompt in addition to the completion (optional).
|
||||
* @param string|null $stop Up to 4 sequences where the API will stop generating (optional).
|
||||
* @param float|null $presencePenalty The presence penalty to use (optional).
|
||||
* @param float|null $frequencyPenalty The frequency penalty to use (optional).
|
||||
* @param int|null $bestOf Generates best_of completions server-side (optional).
|
||||
* @param array|null $logitBias Modify the likelihood of specified tokens (optional).
|
||||
* @param string|null $user A unique identifier representing your end-user (optional).
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function create(
|
||||
string $model,
|
||||
$prompt,
|
||||
?int $maxTokens = null,
|
||||
?string $suffix = null,
|
||||
?float $temperature = null,
|
||||
?float $topP = null,
|
||||
?int $n = null,
|
||||
?bool $stream = null,
|
||||
?int $logprobs = null,
|
||||
?bool $echo = null,
|
||||
$stop = null,
|
||||
?float $presencePenalty = null,
|
||||
?float $frequencyPenalty = null,
|
||||
?int $bestOf = null,
|
||||
?array $logitBias = null,
|
||||
?string $user = null
|
||||
): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/completions";
|
||||
|
||||
// Set the completion data.
|
||||
$data = new \stdClass();
|
||||
$data->model = $model;
|
||||
$data->prompt = $prompt;
|
||||
|
||||
if ($maxTokens !== null)
|
||||
{
|
||||
$data->max_tokens = $maxTokens;
|
||||
}
|
||||
|
||||
if ($temperature !== null)
|
||||
{
|
||||
$data->temperature = $temperature;
|
||||
}
|
||||
|
||||
if ($suffix !== null)
|
||||
{
|
||||
$data->suffix = $suffix;
|
||||
}
|
||||
|
||||
if ($topP !== null)
|
||||
{
|
||||
$data->top_p = $topP;
|
||||
}
|
||||
|
||||
if ($n !== null)
|
||||
{
|
||||
$data->n = $n;
|
||||
}
|
||||
|
||||
if ($stream !== null)
|
||||
{
|
||||
$data->stream = $stream;
|
||||
}
|
||||
|
||||
if ($logprobs !== null)
|
||||
{
|
||||
$data->logprobs = $logprobs;
|
||||
}
|
||||
|
||||
if ($echo !== null)
|
||||
{
|
||||
$data->echo = $echo;
|
||||
}
|
||||
|
||||
if ($stop !== null)
|
||||
{
|
||||
$data->stop = $stop;
|
||||
}
|
||||
|
||||
if ($presencePenalty !== null)
|
||||
{
|
||||
$data->presence_penalty = $presencePenalty;
|
||||
}
|
||||
|
||||
if ($frequencyPenalty !== null)
|
||||
{
|
||||
$data->frequency_penalty = $frequencyPenalty;
|
||||
}
|
||||
|
||||
if ($bestOf !== null)
|
||||
{
|
||||
$data->best_of = $bestOf;
|
||||
}
|
||||
|
||||
if ($logitBias !== null)
|
||||
{
|
||||
$data->logit_bias = new \stdClass();
|
||||
foreach ($logitBias as $key => $val)
|
||||
{
|
||||
$data->logit_bias->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user !== null)
|
||||
{
|
||||
$data->user = $user;
|
||||
}
|
||||
|
||||
// Send the post request.
|
||||
return $this->response->get(
|
||||
$this->http->post(
|
||||
$this->uri->get($path), json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,132 +1 @@
|
||||
/**
|
||||
* Create a completion using the OpenAI API.
|
||||
* API Ref: https://platform.openai.com/docs/api-reference/completions
|
||||
*
|
||||
* @param string $model The ID of the model to use.
|
||||
* @param string|array $prompt The prompt(s) to generate completions for.
|
||||
* @param int|null $maxTokens The maximum number of tokens to generate (optional).
|
||||
* @param float|null $temperature The sampling temperature to use (optional).
|
||||
* @param string $suffix The suffix that comes after a completion of inserted text. (optional).
|
||||
* @param float|null $topP The top_p value for nucleus sampling (optional).
|
||||
* @param int|null $n How many completions to generate (optional).
|
||||
* @param bool|null $stream Whether to stream back partial progress (optional).
|
||||
* @param int|null $logprobs Include the log probabilities on the most likely tokens (optional).
|
||||
* @param bool|null $echo Echo back the prompt in addition to the completion (optional).
|
||||
* @param string|null $stop Up to 4 sequences where the API will stop generating (optional).
|
||||
* @param float|null $presencePenalty The presence penalty to use (optional).
|
||||
* @param float|null $frequencyPenalty The frequency penalty to use (optional).
|
||||
* @param int|null $bestOf Generates best_of completions server-side (optional).
|
||||
* @param array|null $logitBias Modify the likelihood of specified tokens (optional).
|
||||
* @param string|null $user A unique identifier representing your end-user (optional).
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function create(
|
||||
string $model,
|
||||
$prompt,
|
||||
?int $maxTokens = null,
|
||||
?string $suffix = null,
|
||||
?float $temperature = null,
|
||||
?float $topP = null,
|
||||
?int $n = null,
|
||||
?bool $stream = null,
|
||||
?int $logprobs = null,
|
||||
?bool $echo = null,
|
||||
$stop = null,
|
||||
?float $presencePenalty = null,
|
||||
?float $frequencyPenalty = null,
|
||||
?int $bestOf = null,
|
||||
?array $logitBias = null,
|
||||
?string $user = null
|
||||
): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/completions";
|
||||
|
||||
// Set the completion data.
|
||||
$data = new \stdClass();
|
||||
$data->model = $model;
|
||||
$data->prompt = $prompt;
|
||||
|
||||
if ($maxTokens !== null)
|
||||
{
|
||||
$data->max_tokens = $maxTokens;
|
||||
}
|
||||
|
||||
if ($temperature !== null)
|
||||
{
|
||||
$data->temperature = $temperature;
|
||||
}
|
||||
|
||||
if ($suffix !== null)
|
||||
{
|
||||
$data->suffix = $suffix;
|
||||
}
|
||||
|
||||
if ($topP !== null)
|
||||
{
|
||||
$data->top_p = $topP;
|
||||
}
|
||||
|
||||
if ($n !== null)
|
||||
{
|
||||
$data->n = $n;
|
||||
}
|
||||
|
||||
if ($stream !== null)
|
||||
{
|
||||
$data->stream = $stream;
|
||||
}
|
||||
|
||||
if ($logprobs !== null)
|
||||
{
|
||||
$data->logprobs = $logprobs;
|
||||
}
|
||||
|
||||
if ($echo !== null)
|
||||
{
|
||||
$data->echo = $echo;
|
||||
}
|
||||
|
||||
if ($stop !== null)
|
||||
{
|
||||
$data->stop = $stop;
|
||||
}
|
||||
|
||||
if ($presencePenalty !== null)
|
||||
{
|
||||
$data->presence_penalty = $presencePenalty;
|
||||
}
|
||||
|
||||
if ($frequencyPenalty !== null)
|
||||
{
|
||||
$data->frequency_penalty = $frequencyPenalty;
|
||||
}
|
||||
|
||||
if ($bestOf !== null)
|
||||
{
|
||||
$data->best_of = $bestOf;
|
||||
}
|
||||
|
||||
if ($logitBias !== null)
|
||||
{
|
||||
$data->logit_bias = new \stdClass();
|
||||
foreach ($logitBias as $key => $val)
|
||||
{
|
||||
$data->logit_bias->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user !== null)
|
||||
{
|
||||
$data->user = $user;
|
||||
}
|
||||
|
||||
// Send the post request.
|
||||
return $this->response->get(
|
||||
$this->http->post(
|
||||
$this->uri->get($path), json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,18 +1 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "585de711-2784-4f89-90bf-94a8a63366f1",
|
||||
"guid": "796cca70-2577-4f8f-9a05-ac37db1f2f02",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Completions",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Completions",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Openai\\Completions",
|
||||
"description": "The Openai Completions\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,66 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Response (Details)
|
||||
> namespace: **VDM\Joomla\Openai\Utilities**
|
||||
```uml
|
||||
@startuml
|
||||
class Response << (F,LightGreen) >> #Green {
|
||||
+ get(JoomlaResponse $response, int $expectedCode = 200, ...) : mixed
|
||||
+ get_(JoomlaResponse $response, array $validate = [200 => null]) : mixed
|
||||
# body(JoomlaResponse $response, mixed $default = null) : mixed
|
||||
# error(JoomlaResponse $response) : string
|
||||
}
|
||||
|
||||
note right of Response::get
|
||||
Process the response and decode it.
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
JoomlaResponse $response
|
||||
int $expectedCode = 200
|
||||
mixed $default = null
|
||||
end note
|
||||
|
||||
note right of Response::get_
|
||||
Process the response and decode it. (when we have multiple success codes)
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Response::body
|
||||
Return the body from the response
|
||||
|
||||
since: 3.2.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Response::error
|
||||
Get the error message from the OpenAI API response
|
||||
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,132 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Http\Response as JoomlaResponse;
|
||||
use VDM\Joomla\Utilities\JsonHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Response
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class Response
|
||||
{
|
||||
/**
|
||||
* Process the response and decode it.
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
* @param integer $expectedCode The expected "good" code.
|
||||
* @param mixed $default The default if body not have length
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \DomainException
|
||||
**/
|
||||
public function get(JoomlaResponse $response, int $expectedCode = 200, $default = null)
|
||||
{
|
||||
// Validate the response code.
|
||||
if ($response->code != $expectedCode)
|
||||
{
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
// Throw an exception with the OpenAI error message and code.
|
||||
throw new \DomainException($message, $response->code);
|
||||
}
|
||||
|
||||
return $this->body($response, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the response and decode it. (when we have multiple success codes)
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
* @param array [$expectedCode => $default] The expected "good" code. and The default if body not have length
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \DomainException
|
||||
**/
|
||||
public function get_(JoomlaResponse $response, array $validate = [200 => null])
|
||||
{
|
||||
// Validate the response code.
|
||||
if (!isset($validate[$response->code]))
|
||||
{
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
// Throw an exception with the OpenAI error message and code.
|
||||
throw new \DomainException($message, $response->code);
|
||||
|
||||
}
|
||||
|
||||
return $this->body($response, $validate[$response->code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the body from the response
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
* @param mixed $default The default if body not have length
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected function body(JoomlaResponse $response, $default = null)
|
||||
{
|
||||
// check that we have a body and that its JSON
|
||||
if (isset($response->body) && StringHelper::check($response->body))
|
||||
{
|
||||
if (JsonHelper::check($response->body))
|
||||
{
|
||||
return json_decode((string) $response->body);
|
||||
}
|
||||
|
||||
return $response->body;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error message from the OpenAI API response
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected function error(JoomlaResponse $response): string
|
||||
{
|
||||
// do we have a json string
|
||||
if (isset($response->body) && JsonHelper::check($response->body))
|
||||
{
|
||||
$error = json_decode($response->body);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'Invalid or empty response body.';
|
||||
}
|
||||
|
||||
// check if OpenAI returned an error object
|
||||
if (isset($error->error))
|
||||
{
|
||||
// error object found, extract message and code
|
||||
$errorMessage = isset($error->error->message) ? $error->error->message : 'Unknown error.';
|
||||
$errorCode = isset($error->error->code) ? $error->error->code : 'Unknown error code.';
|
||||
|
||||
// return formatted error message
|
||||
return 'OpenAI Error: ' . $errorMessage . ' Code: ' . $errorCode;
|
||||
}
|
||||
|
||||
return 'No error information found in response.';
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,112 +1 @@
|
||||
/**
|
||||
* Process the response and decode it.
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
* @param integer $expectedCode The expected "good" code.
|
||||
* @param mixed $default The default if body not have length
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \DomainException
|
||||
**/
|
||||
public function get(JoomlaResponse $response, int $expectedCode = 200, $default = null)
|
||||
{
|
||||
// Validate the response code.
|
||||
if ($response->code != $expectedCode)
|
||||
{
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
// Throw an exception with the OpenAI error message and code.
|
||||
throw new \DomainException($message, $response->code);
|
||||
}
|
||||
|
||||
return $this->body($response, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the response and decode it. (when we have multiple success codes)
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
* @param array [$expectedCode => $default] The expected "good" code. and The default if body not have length
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @since 3.2.0
|
||||
* @throws \DomainException
|
||||
**/
|
||||
public function get_(JoomlaResponse $response, array $validate = [200 => null])
|
||||
{
|
||||
// Validate the response code.
|
||||
if (!isset($validate[$response->code]))
|
||||
{
|
||||
// Decode the error response and throw an exception.
|
||||
$message = $this->error($response);
|
||||
|
||||
// Throw an exception with the OpenAI error message and code.
|
||||
throw new \DomainException($message, $response->code);
|
||||
|
||||
}
|
||||
|
||||
return $this->body($response, $validate[$response->code]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the body from the response
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
* @param mixed $default The default if body not have length
|
||||
*
|
||||
* @return mixed
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected function body(JoomlaResponse $response, $default = null)
|
||||
{
|
||||
// check that we have a body and that its JSON
|
||||
if (isset($response->body) && StringHelper::check($response->body))
|
||||
{
|
||||
if (JsonHelper::check($response->body))
|
||||
{
|
||||
return json_decode((string) $response->body);
|
||||
}
|
||||
|
||||
return $response->body;
|
||||
}
|
||||
|
||||
return $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error message from the OpenAI API response
|
||||
*
|
||||
* @param JoomlaResponse $response The response.
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.0
|
||||
**/
|
||||
protected function error(JoomlaResponse $response): string
|
||||
{
|
||||
// do we have a json string
|
||||
if (isset($response->body) && JsonHelper::check($response->body))
|
||||
{
|
||||
$error = json_decode($response->body);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'Invalid or empty response body.';
|
||||
}
|
||||
|
||||
// check if OpenAI returned an error object
|
||||
if (isset($error->error))
|
||||
{
|
||||
// error object found, extract message and code
|
||||
$errorMessage = isset($error->error->message) ? $error->error->message : 'Unknown error.';
|
||||
$errorCode = isset($error->error->code) ? $error->error->code : 'Unknown error code.';
|
||||
|
||||
// return formatted error message
|
||||
return 'OpenAI Error: ' . $errorMessage . ' Code: ' . $errorCode;
|
||||
}
|
||||
|
||||
return 'No error information found in response.';
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,27 +1 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "c464393e-7606-406e-8463-a86774590966",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Response",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Utilities.Response",
|
||||
"type": "final class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\Openai\\Utilities.Response",
|
||||
"description": "The Openai Response\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Http\\Response as JoomlaResponse;",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,62 +1 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Chat (Details)
|
||||
> namespace: **VDM\Joomla\Openai**
|
||||
```uml
|
||||
@startuml
|
||||
class Chat #Gold {
|
||||
+ create(string $model, array $messages, ...) : ?object
|
||||
}
|
||||
|
||||
note right of Chat::create
|
||||
Create a chat completion with the OpenAI API.
|
||||
API Ref: https://platform.openai.com/docs/api-reference/chat/create
|
||||
Each item in the array is an object with the following:
|
||||
- role (string) Required
|
||||
The role of the author of this message.
|
||||
One of system, user, or assistant.
|
||||
- content (string) Required
|
||||
The contents of the message.
|
||||
- name (string) Optional
|
||||
The name of the author of this message.
|
||||
May contain a-z, A-Z, 0-9, and underscores,
|
||||
with a maximum length of 64 characters.
|
||||
|
||||
since: 3.2.0
|
||||
return: ?object
|
||||
|
||||
arguments:
|
||||
string $model
|
||||
array $messages
|
||||
?int $maxTokens = null
|
||||
?float $temperature = null
|
||||
?float $topP = null
|
||||
?int $n = null
|
||||
?bool $stream = null
|
||||
mixed|null $stop = null
|
||||
?float $presencePenalty = null
|
||||
?float $frequencyPenalty = null
|
||||
?array $logitBias = null
|
||||
?string $user = null
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
||||
###POWERREADME###
|
@ -9,134 +9,4 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Openai;
|
||||
|
||||
|
||||
use VDM\Joomla\Openai\Abstraction\Api;
|
||||
|
||||
|
||||
/**
|
||||
* The Openai Chat
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Chat extends Api
|
||||
{
|
||||
/**
|
||||
* Create a chat completion with the OpenAI API.
|
||||
* API Ref: https://platform.openai.com/docs/api-reference/chat/create
|
||||
*
|
||||
* @param string $model The model to use for completion.
|
||||
* @param array $messages A list of messages describing the conversation so far.
|
||||
*
|
||||
* Each item in the array is an object with the following:
|
||||
* - role (string) Required
|
||||
* The role of the author of this message.
|
||||
* One of system, user, or assistant.
|
||||
* - content (string) Required
|
||||
* The contents of the message.
|
||||
* - name (string) Optional
|
||||
* The name of the author of this message.
|
||||
* May contain a-z, A-Z, 0-9, and underscores,
|
||||
* with a maximum length of 64 characters.
|
||||
*
|
||||
* @param int|null $maxTokens Maximum number of tokens to generate (optional).
|
||||
* @param float|null $temperature The sampling temperature to use (optional).
|
||||
* @param float|null $topP The nucleus sampling parameter (optional).
|
||||
* @param int|null $n The number of chat completion choices to generate (optional).
|
||||
* @param bool|null $stream Partial message deltas (optional).
|
||||
* @param mixed|null $stop Sequences where the API will stop generating tokens (optional).
|
||||
* @param float|null $presencePenalty Penalty for new tokens based on whether they appear in the text (optional).
|
||||
* @param float|null $frequencyPenalty Penalty for new tokens based on their frequency in the text (optional).
|
||||
* @param array|null $logitBias Modify the likelihood of specified tokens appearing (optional).
|
||||
* @param string|null $user A unique identifier representing the end-user (optional).
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function create(
|
||||
string $model,
|
||||
array $messages,
|
||||
?int $maxTokens = null,
|
||||
?float $temperature = null,
|
||||
?float $topP = null,
|
||||
?int $n = null,
|
||||
?bool $stream = null,
|
||||
$stop = null,
|
||||
?float $presencePenalty = null,
|
||||
?float $frequencyPenalty = null,
|
||||
?array $logitBias = null,
|
||||
?string $user = null
|
||||
): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/chat/completions";
|
||||
|
||||
// Set the request data.
|
||||
$data = new \stdClass();
|
||||
$data->model = $model;
|
||||
$data->messages = $messages;
|
||||
|
||||
if ($maxTokens !== null)
|
||||
{
|
||||
$data->max_tokens = $maxTokens;
|
||||
}
|
||||
|
||||
if ($temperature !== null)
|
||||
{
|
||||
$data->temperature = $temperature;
|
||||
}
|
||||
|
||||
if ($topP !== null)
|
||||
{
|
||||
$data->top_p = $topP;
|
||||
}
|
||||
|
||||
if ($n !== null)
|
||||
{
|
||||
$data->n = $n;
|
||||
}
|
||||
|
||||
if ($stream !== null)
|
||||
{
|
||||
$data->stream = $stream;
|
||||
}
|
||||
|
||||
if ($stop !== null)
|
||||
{
|
||||
$data->stop = $stop;
|
||||
}
|
||||
|
||||
if ($presencePenalty !== null)
|
||||
{
|
||||
$data->presence_penalty = $presencePenalty;
|
||||
}
|
||||
|
||||
if ($frequencyPenalty !== null)
|
||||
{
|
||||
$data->frequency_penalty = $frequencyPenalty;
|
||||
}
|
||||
|
||||
if ($logitBias !== null)
|
||||
{
|
||||
$data->logit_bias = new \stdClass();
|
||||
foreach ($logitBias as $key => $val)
|
||||
{
|
||||
$data->logit_bias->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user !== null)
|
||||
{
|
||||
$data->user = $user;
|
||||
}
|
||||
|
||||
// Send the post request.
|
||||
return $this->response->get(
|
||||
$this->http->post(
|
||||
$this->uri->get($path), json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
###POWERCODE###
|
||||
|
@ -1,116 +1 @@
|
||||
/**
|
||||
* Create a chat completion with the OpenAI API.
|
||||
* API Ref: https://platform.openai.com/docs/api-reference/chat/create
|
||||
*
|
||||
* @param string $model The model to use for completion.
|
||||
* @param array $messages A list of messages describing the conversation so far.
|
||||
*
|
||||
* Each item in the array is an object with the following:
|
||||
* - role (string) Required
|
||||
* The role of the author of this message.
|
||||
* One of system, user, or assistant.
|
||||
* - content (string) Required
|
||||
* The contents of the message.
|
||||
* - name (string) Optional
|
||||
* The name of the author of this message.
|
||||
* May contain a-z, A-Z, 0-9, and underscores,
|
||||
* with a maximum length of 64 characters.
|
||||
*
|
||||
* @param int|null $maxTokens Maximum number of tokens to generate (optional).
|
||||
* @param float|null $temperature The sampling temperature to use (optional).
|
||||
* @param float|null $topP The nucleus sampling parameter (optional).
|
||||
* @param int|null $n The number of chat completion choices to generate (optional).
|
||||
* @param bool|null $stream Partial message deltas (optional).
|
||||
* @param mixed|null $stop Sequences where the API will stop generating tokens (optional).
|
||||
* @param float|null $presencePenalty Penalty for new tokens based on whether they appear in the text (optional).
|
||||
* @param float|null $frequencyPenalty Penalty for new tokens based on their frequency in the text (optional).
|
||||
* @param array|null $logitBias Modify the likelihood of specified tokens appearing (optional).
|
||||
* @param string|null $user A unique identifier representing the end-user (optional).
|
||||
*
|
||||
* @return object|null
|
||||
* @since 3.2.0
|
||||
**/
|
||||
public function create(
|
||||
string $model,
|
||||
array $messages,
|
||||
?int $maxTokens = null,
|
||||
?float $temperature = null,
|
||||
?float $topP = null,
|
||||
?int $n = null,
|
||||
?bool $stream = null,
|
||||
$stop = null,
|
||||
?float $presencePenalty = null,
|
||||
?float $frequencyPenalty = null,
|
||||
?array $logitBias = null,
|
||||
?string $user = null
|
||||
): ?object
|
||||
{
|
||||
// Build the request path.
|
||||
$path = "/chat/completions";
|
||||
|
||||
// Set the request data.
|
||||
$data = new \stdClass();
|
||||
$data->model = $model;
|
||||
$data->messages = $messages;
|
||||
|
||||
if ($maxTokens !== null)
|
||||
{
|
||||
$data->max_tokens = $maxTokens;
|
||||
}
|
||||
|
||||
if ($temperature !== null)
|
||||
{
|
||||
$data->temperature = $temperature;
|
||||
}
|
||||
|
||||
if ($topP !== null)
|
||||
{
|
||||
$data->top_p = $topP;
|
||||
}
|
||||
|
||||
if ($n !== null)
|
||||
{
|
||||
$data->n = $n;
|
||||
}
|
||||
|
||||
if ($stream !== null)
|
||||
{
|
||||
$data->stream = $stream;
|
||||
}
|
||||
|
||||
if ($stop !== null)
|
||||
{
|
||||
$data->stop = $stop;
|
||||
}
|
||||
|
||||
if ($presencePenalty !== null)
|
||||
{
|
||||
$data->presence_penalty = $presencePenalty;
|
||||
}
|
||||
|
||||
if ($frequencyPenalty !== null)
|
||||
{
|
||||
$data->frequency_penalty = $frequencyPenalty;
|
||||
}
|
||||
|
||||
if ($logitBias !== null)
|
||||
{
|
||||
$data->logit_bias = new \stdClass();
|
||||
foreach ($logitBias as $key => $val)
|
||||
{
|
||||
$data->logit_bias->$key = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user !== null)
|
||||
{
|
||||
$data->user = $user;
|
||||
}
|
||||
|
||||
// Send the post request.
|
||||
return $this->response->get(
|
||||
$this->http->post(
|
||||
$this->uri->get($path), json_encode($data)
|
||||
)
|
||||
);
|
||||
}
|
||||
###CODEPOWER###
|
@ -1,18 +1 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "585de711-2784-4f89-90bf-94a8a63366f1",
|
||||
"guid": "c54c92da-2dd7-4136-81c9-1785f2fa0af5",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Chat",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Openai.Chat",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"namespace": "VDM\\Joomla\\Openai\\Chat",
|
||||
"description": "The Openai Chat\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
||||
###POWERLINKER###
|
@ -1,189 +1 @@
|
||||
{
|
||||
"07858e1f-5698-4227-8941-03dc93557938": {
|
||||
"name": "Utilities",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai\\Service",
|
||||
"code": "src\/07858e1f-5698-4227-8941-03dc93557938\/code.php",
|
||||
"power": "src\/07858e1f-5698-4227-8941-03dc93557938\/code.power",
|
||||
"settings": "src\/07858e1f-5698-4227-8941-03dc93557938\/settings.json",
|
||||
"path": "src\/07858e1f-5698-4227-8941-03dc93557938",
|
||||
"spk": "Super__07858e1f_5698_4227_8941_03dc93557938__Power",
|
||||
"guid": "07858e1f-5698-4227-8941-03dc93557938"
|
||||
},
|
||||
"08abd2df-1406-4939-a1a6-94d2fce3f043": {
|
||||
"name": "Models",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/08abd2df-1406-4939-a1a6-94d2fce3f043\/code.php",
|
||||
"power": "src\/08abd2df-1406-4939-a1a6-94d2fce3f043\/code.power",
|
||||
"settings": "src\/08abd2df-1406-4939-a1a6-94d2fce3f043\/settings.json",
|
||||
"path": "src\/08abd2df-1406-4939-a1a6-94d2fce3f043",
|
||||
"spk": "Super__08abd2df_1406_4939_a1a6_94d2fce3f043__Power",
|
||||
"guid": "08abd2df-1406-4939-a1a6-94d2fce3f043"
|
||||
},
|
||||
"0e61da13-6429-426d-a6f9-f5723cd3b7b1": {
|
||||
"name": "FineTunes",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/0e61da13-6429-426d-a6f9-f5723cd3b7b1\/code.php",
|
||||
"power": "src\/0e61da13-6429-426d-a6f9-f5723cd3b7b1\/code.power",
|
||||
"settings": "src\/0e61da13-6429-426d-a6f9-f5723cd3b7b1\/settings.json",
|
||||
"path": "src\/0e61da13-6429-426d-a6f9-f5723cd3b7b1",
|
||||
"spk": "Super__0e61da13_6429_426d_a6f9_f5723cd3b7b1__Power",
|
||||
"guid": "0e61da13-6429-426d-a6f9-f5723cd3b7b1"
|
||||
},
|
||||
"13ef84f4-25b0-43dd-a9f6-0722abf220c1": {
|
||||
"name": "Uri",
|
||||
"type": "final class",
|
||||
"namespace": "VDM\\Joomla\\Openai\\Utilities",
|
||||
"code": "src\/13ef84f4-25b0-43dd-a9f6-0722abf220c1\/code.php",
|
||||
"power": "src\/13ef84f4-25b0-43dd-a9f6-0722abf220c1\/code.power",
|
||||
"settings": "src\/13ef84f4-25b0-43dd-a9f6-0722abf220c1\/settings.json",
|
||||
"path": "src\/13ef84f4-25b0-43dd-a9f6-0722abf220c1",
|
||||
"spk": "Super__13ef84f4_25b0_43dd_a9f6_0722abf220c1__Power",
|
||||
"guid": "13ef84f4-25b0-43dd-a9f6-0722abf220c1"
|
||||
},
|
||||
"34f2c249-64a7-4229-9592-77e58f6e994f": {
|
||||
"name": "Moderate",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/34f2c249-64a7-4229-9592-77e58f6e994f\/code.php",
|
||||
"power": "src\/34f2c249-64a7-4229-9592-77e58f6e994f\/code.power",
|
||||
"settings": "src\/34f2c249-64a7-4229-9592-77e58f6e994f\/settings.json",
|
||||
"path": "src\/34f2c249-64a7-4229-9592-77e58f6e994f",
|
||||
"spk": "Super__34f2c249_64a7_4229_9592_77e58f6e994f__Power",
|
||||
"guid": "34f2c249-64a7-4229-9592-77e58f6e994f"
|
||||
},
|
||||
"4c58b254-aea5-40aa-b54d-9586a1690451": {
|
||||
"name": "Http",
|
||||
"type": "final class",
|
||||
"namespace": "VDM\\Joomla\\Openai\\Utilities",
|
||||
"code": "src\/4c58b254-aea5-40aa-b54d-9586a1690451\/code.php",
|
||||
"power": "src\/4c58b254-aea5-40aa-b54d-9586a1690451\/code.power",
|
||||
"settings": "src\/4c58b254-aea5-40aa-b54d-9586a1690451\/settings.json",
|
||||
"path": "src\/4c58b254-aea5-40aa-b54d-9586a1690451",
|
||||
"spk": "Super__4c58b254_aea5_40aa_b54d_9586a1690451__Power",
|
||||
"guid": "4c58b254-aea5-40aa-b54d-9586a1690451"
|
||||
},
|
||||
"585de711-2784-4f89-90bf-94a8a63366f1": {
|
||||
"name": "Api",
|
||||
"type": "abstract class",
|
||||
"namespace": "VDM\\Joomla\\Openai\\Abstraction",
|
||||
"code": "src\/585de711-2784-4f89-90bf-94a8a63366f1\/code.php",
|
||||
"power": "src\/585de711-2784-4f89-90bf-94a8a63366f1\/code.power",
|
||||
"settings": "src\/585de711-2784-4f89-90bf-94a8a63366f1\/settings.json",
|
||||
"path": "src\/585de711-2784-4f89-90bf-94a8a63366f1",
|
||||
"spk": "Super__585de711_2784_4f89_90bf_94a8a63366f1__Power",
|
||||
"guid": "585de711-2784-4f89-90bf-94a8a63366f1"
|
||||
},
|
||||
"65dd022b-8f3a-46be-8930-0cae74b9834b": {
|
||||
"name": "Files",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/65dd022b-8f3a-46be-8930-0cae74b9834b\/code.php",
|
||||
"power": "src\/65dd022b-8f3a-46be-8930-0cae74b9834b\/code.power",
|
||||
"settings": "src\/65dd022b-8f3a-46be-8930-0cae74b9834b\/settings.json",
|
||||
"path": "src\/65dd022b-8f3a-46be-8930-0cae74b9834b",
|
||||
"spk": "Super__65dd022b_8f3a_46be_8930_0cae74b9834b__Power",
|
||||
"guid": "65dd022b-8f3a-46be-8930-0cae74b9834b"
|
||||
},
|
||||
"796cca70-2577-4f8f-9a05-ac37db1f2f02": {
|
||||
"name": "Completions",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/796cca70-2577-4f8f-9a05-ac37db1f2f02\/code.php",
|
||||
"power": "src\/796cca70-2577-4f8f-9a05-ac37db1f2f02\/code.power",
|
||||
"settings": "src\/796cca70-2577-4f8f-9a05-ac37db1f2f02\/settings.json",
|
||||
"path": "src\/796cca70-2577-4f8f-9a05-ac37db1f2f02",
|
||||
"spk": "Super__796cca70_2577_4f8f_9a05_ac37db1f2f02__Power",
|
||||
"guid": "796cca70-2577-4f8f-9a05-ac37db1f2f02"
|
||||
},
|
||||
"98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8": {
|
||||
"name": "Edits",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8\/code.php",
|
||||
"power": "src\/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8\/code.power",
|
||||
"settings": "src\/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8\/settings.json",
|
||||
"path": "src\/98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8",
|
||||
"spk": "Super__98e59bdf_81a2_41ef_a3a6_6a88a7cc53c8__Power",
|
||||
"guid": "98e59bdf-81a2-41ef-a3a6-6a88a7cc53c8"
|
||||
},
|
||||
"bb8973c1-261f-4b55-8f9b-9ee98843fced": {
|
||||
"name": "Images",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/bb8973c1-261f-4b55-8f9b-9ee98843fced\/code.php",
|
||||
"power": "src\/bb8973c1-261f-4b55-8f9b-9ee98843fced\/code.power",
|
||||
"settings": "src\/bb8973c1-261f-4b55-8f9b-9ee98843fced\/settings.json",
|
||||
"path": "src\/bb8973c1-261f-4b55-8f9b-9ee98843fced",
|
||||
"spk": "Super__bb8973c1_261f_4b55_8f9b_9ee98843fced__Power",
|
||||
"guid": "bb8973c1-261f-4b55-8f9b-9ee98843fced"
|
||||
},
|
||||
"c464393e-7606-406e-8463-a86774590966": {
|
||||
"name": "Response",
|
||||
"type": "final class",
|
||||
"namespace": "VDM\\Joomla\\Openai\\Utilities",
|
||||
"code": "src\/c464393e-7606-406e-8463-a86774590966\/code.php",
|
||||
"power": "src\/c464393e-7606-406e-8463-a86774590966\/code.power",
|
||||
"settings": "src\/c464393e-7606-406e-8463-a86774590966\/settings.json",
|
||||
"path": "src\/c464393e-7606-406e-8463-a86774590966",
|
||||
"spk": "Super__c464393e_7606_406e_8463_a86774590966__Power",
|
||||
"guid": "c464393e-7606-406e-8463-a86774590966"
|
||||
},
|
||||
"c54c92da-2dd7-4136-81c9-1785f2fa0af5": {
|
||||
"name": "Chat",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/c54c92da-2dd7-4136-81c9-1785f2fa0af5\/code.php",
|
||||
"power": "src\/c54c92da-2dd7-4136-81c9-1785f2fa0af5\/code.power",
|
||||
"settings": "src\/c54c92da-2dd7-4136-81c9-1785f2fa0af5\/settings.json",
|
||||
"path": "src\/c54c92da-2dd7-4136-81c9-1785f2fa0af5",
|
||||
"spk": "Super__c54c92da_2dd7_4136_81c9_1785f2fa0af5__Power",
|
||||
"guid": "c54c92da-2dd7-4136-81c9-1785f2fa0af5"
|
||||
},
|
||||
"ccf3141a-929d-4466-b122-9ace2eea8d70": {
|
||||
"name": "Api",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai\\Service",
|
||||
"code": "src\/ccf3141a-929d-4466-b122-9ace2eea8d70\/code.php",
|
||||
"power": "src\/ccf3141a-929d-4466-b122-9ace2eea8d70\/code.power",
|
||||
"settings": "src\/ccf3141a-929d-4466-b122-9ace2eea8d70\/settings.json",
|
||||
"path": "src\/ccf3141a-929d-4466-b122-9ace2eea8d70",
|
||||
"spk": "Super__ccf3141a_929d_4466_b122_9ace2eea8d70__Power",
|
||||
"guid": "ccf3141a-929d-4466-b122-9ace2eea8d70"
|
||||
},
|
||||
"d76b2e22-c8dd-44b1-86b5-822768b317a3": {
|
||||
"name": "Audio",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/d76b2e22-c8dd-44b1-86b5-822768b317a3\/code.php",
|
||||
"power": "src\/d76b2e22-c8dd-44b1-86b5-822768b317a3\/code.power",
|
||||
"settings": "src\/d76b2e22-c8dd-44b1-86b5-822768b317a3\/settings.json",
|
||||
"path": "src\/d76b2e22-c8dd-44b1-86b5-822768b317a3",
|
||||
"spk": "Super__d76b2e22_c8dd_44b1_86b5_822768b317a3__Power",
|
||||
"guid": "d76b2e22-c8dd-44b1-86b5-822768b317a3"
|
||||
},
|
||||
"d78bee89-6f7e-42b6-917e-17f05b238490": {
|
||||
"name": "Factory",
|
||||
"type": "abstract class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/d78bee89-6f7e-42b6-917e-17f05b238490\/code.php",
|
||||
"power": "src\/d78bee89-6f7e-42b6-917e-17f05b238490\/code.power",
|
||||
"settings": "src\/d78bee89-6f7e-42b6-917e-17f05b238490\/settings.json",
|
||||
"path": "src\/d78bee89-6f7e-42b6-917e-17f05b238490",
|
||||
"spk": "Super__d78bee89_6f7e_42b6_917e_17f05b238490__Power",
|
||||
"guid": "d78bee89-6f7e-42b6-917e-17f05b238490"
|
||||
},
|
||||
"df141f03-393f-4fa3-a568-8b65f7358b02": {
|
||||
"name": "Embeddings",
|
||||
"type": "class",
|
||||
"namespace": "VDM\\Joomla\\Openai",
|
||||
"code": "src\/df141f03-393f-4fa3-a568-8b65f7358b02\/code.php",
|
||||
"power": "src\/df141f03-393f-4fa3-a568-8b65f7358b02\/code.power",
|
||||
"settings": "src\/df141f03-393f-4fa3-a568-8b65f7358b02\/settings.json",
|
||||
"path": "src\/df141f03-393f-4fa3-a568-8b65f7358b02",
|
||||
"spk": "Super__df141f03_393f_4fa3_a568_8b65f7358b02__Power",
|
||||
"guid": "df141f03-393f-4fa3-a568-8b65f7358b02"
|
||||
}
|
||||
}
|
||||
###POWERINDEX###
|
Loading…
Reference in New Issue
Block a user