Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to the new task processing API #102

Merged
merged 22 commits into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ jobs:

- name: PHPUnit
working-directory: apps/${{ env.APP_NAME }}
run: phpunit -c tests/phpunit.xml
run: composer run test:unit
4 changes: 2 additions & 2 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
ocp-version: [ '^28', 'dev-master' ]
ocp-version: [ 'dev-master' ]
php-version: [ '8.0', '8.1', '8.2', '8.3' ]


Expand All @@ -63,7 +63,7 @@ jobs:
run: composer require --dev nextcloud/ocp:${{ matrix.ocp-version }} --ignore-platform-reqs --with-dependencies

- name: Install dependencies
run: composer require --dev
run: composer require --dev

- name: Run coding standards check
run: composer run psalm
Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ as they are now included in the [Assistant app](https://apps.nextcloud.com/apps/

This app implements:

* Text generation providers: Free prompt, Summarize, Headline and Reformulate (using any available large language model)
* Text generation providers: Free prompt, Summarize, Headline, Context write, Chat, and Reformulate (using any available large language model)
* A Translation provider (using any available language model)
* A SpeechToText provider (using Whisper)
* An image generation provider
Expand All @@ -14,64 +14,64 @@ Instead of connecting to the OpenAI API for these, you can also connect to a sel
or to any service that implements an API similar to the OpenAI one, for example: [Plusserver](https://www.plusserver.com/en/ai-platform/) or [MistralAI](https://mistral.ai).

## Ethical AI Rating
### Rating for Text generation using ChatGPT via OpenAI API: 🔴
### Rating for Text generation using ChatGPT via the OpenAI API: 🔴

Negative:
* the software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* the trained model is not freely available, so the model can not be run on-premises
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.
* The software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* The trained model is not freely available, so the model can not be run on-premises
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.


### Rating for Translation using ChatGPT via OpenAI API: 🔴
### Rating for Translation using ChatGPT via the OpenAI API: 🔴

Negative:
* the software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* the trained model is not freely available, so the model can not be run on-premises
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.
* The software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* The trained model is not freely available, so the model can not be run on-premises
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.

### Rating for Image generation using DALL·E via OpenAI API: 🔴
### Rating for Image generation using DALL·E via the OpenAI API: 🔴

Negative:
* the software for training and inferencing of this model is proprietary, limiting running it locally or training by yourself
* the trained model is not freely available, so the model can not be ran on-premises
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The software for training and inferencing of this model is proprietary, limiting running it locally or training by yourself
* The trained model is not freely available, so the model can not be ran on-premises
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.


### Rating for Speech-To-Text using Whisper via OpenAI API: 🟡
### Rating for Speech-To-Text using Whisper via the OpenAI API: 🟡

Positive:
* the software for training and inferencing of this model is open source
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can run on-premise

Negative:
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.

### Rating for Text generation via LocalAI: 🟢

Positive:
* the software for training and inferencing of this model is open source
* the trained model is freely available, and thus can be ran on-premises
* the training data is freely available, making it possible to check or correct for bias or optimise the performance and CO2 usage.
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can be ran on-premises
* The training data is freely available, making it possible to check or correct for bias or optimise the performance and CO2 usage.


### Rating for Image generation using Stable Diffusion via LocalAI : 🟡

Positive:
* the software for training and inferencing of this model is open source
* the trained model is freely available, and thus can be ran on-premises
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can be ran on-premises

Negative:
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.


### Rating for Speech-To-Text using Whisper via LocalAI: 🟡

Positive:
* the software for training and inferencing of this model is open source
* the trained model is freely available, and thus can be ran on-premises
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can be ran on-premises

Negative:
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.


Learn more about the Nextcloud Ethical AI Rating [in our blog](https://nextcloud.com/blog/nextcloud-ethical-ai-rating/).
Expand Down
52 changes: 26 additions & 26 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ as they are now included in the [Assistant app](https://apps.nextcloud.com/apps/

This app implements:

* Text generation providers: Free prompt, Summarize, Headline and Reformulate (using any available large language model)
* Text generation providers: Free prompt, Summarize, Headline, Context write, Chat, and Reformulate (using any available large language model)
* A Translation provider (using any available language model)
* A SpeechToText provider (using Whisper)
* An image generation provider
Expand All @@ -18,64 +18,64 @@ Instead of connecting to the OpenAI API for these, you can also connect to a sel
or to any service that implements an API similar to the OpenAI one, for example: [Plusserver](https://www.plusserver.com/en/ai-platform/) or [MistralAI](https://mistral.ai).

## Ethical AI Rating
### Rating for Text generation using ChatGPT via OpenAI API: 🔴
### Rating for Text generation using ChatGPT via the OpenAI API: 🔴

Negative:
* the software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* the trained model is not freely available, so the model can not be run on-premises
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.
* The software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* The trained model is not freely available, so the model can not be run on-premises
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.


### Rating for Translation using ChatGPT via OpenAI API: 🔴
### Rating for Translation using ChatGPT via the OpenAI API: 🔴

Negative:
* the software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* the trained model is not freely available, so the model can not be run on-premises
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.
* The software for training and inference of this model is proprietary, limiting running it locally or training by yourself
* The trained model is not freely available, so the model can not be run on-premises
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model's performance and CO2 usage.

### Rating for Image generation using DALL·E via OpenAI API: 🔴
### Rating for Image generation using DALL·E via the OpenAI API: 🔴

Negative:
* the software for training and inferencing of this model is proprietary, limiting running it locally or training by yourself
* the trained model is not freely available, so the model can not be ran on-premises
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The software for training and inferencing of this model is proprietary, limiting running it locally or training by yourself
* The trained model is not freely available, so the model can not be ran on-premises
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.


### Rating for Speech-To-Text using Whisper via OpenAI API: 🟡
### Rating for Speech-To-Text using Whisper via the OpenAI API: 🟡

Positive:
* the software for training and inferencing of this model is open source
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can run on-premise

Negative:
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.

### Rating for Text generation via LocalAI: 🟢

Positive:
* the software for training and inferencing of this model is open source
* the trained model is freely available, and thus can be ran on-premises
* the training data is freely available, making it possible to check or correct for bias or optimise the performance and CO2 usage.
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can be ran on-premises
* The training data is freely available, making it possible to check or correct for bias or optimise the performance and CO2 usage.


### Rating for Image generation using Stable Diffusion via LocalAI : 🟡

Positive:
* the software for training and inferencing of this model is open source
* the trained model is freely available, and thus can be ran on-premises
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can be ran on-premises

Negative:
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.


### Rating for Speech-To-Text using Whisper via LocalAI: 🟡

Positive:
* the software for training and inferencing of this model is open source
* the trained model is freely available, and thus can be ran on-premises
* The software for training and inferencing of this model is open source
* The trained model is freely available, and thus can be ran on-premises

Negative:
* the training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.
* The training data is not freely available, limiting the ability of external parties to check and correct for bias or optimise the model’s performance and CO2 usage.

Learn more about the Nextcloud Ethical AI Rating [in our blog](https://nextcloud.com/blog/nextcloud-ethical-ai-rating/).
]]> </description>
Expand All @@ -94,7 +94,7 @@ Learn more about the Nextcloud Ethical AI Rating [in our blog](https://nextcloud
<screenshot>https://github.com/nextcloud/integration_openai/raw/main/img/screenshot3.jpg</screenshot>
<screenshot>https://github.com/nextcloud/integration_openai/raw/main/img/screenshot4.jpg</screenshot>
<dependencies>
<nextcloud min-version="28" max-version="30"/>
<nextcloud min-version="30" max-version="30"/>
</dependencies>
<background-jobs>
<job>OCA\OpenAi\Cron\CleanupQuotaDb</job>
Expand Down
2 changes: 2 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
return [
'routes' => [
['name' => 'config#setUserConfig', 'url' => '/config', 'verb' => 'PUT'],
['name' => 'config#setSensitiveUserConfig', 'url' => '/config/sensitive', 'verb' => 'PUT'],
['name' => 'config#setAdminConfig', 'url' => '/admin-config', 'verb' => 'PUT'],
['name' => 'config#setSensitiveAdminConfig', 'url' => '/admin-config/sensitive', 'verb' => 'PUT'],

['name' => 'openAiAPI#getModels', 'url' => '/models', 'verb' => 'GET'],
['name' => 'openAiAPI#getUserQuotaInfo', 'url' => '/quota-info', 'verb' => 'GET'],
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"cs:fix": "php-cs-fixer fix",
"test:unit": "phpunit --config tests/phpunit.xml",
"psalm": "psalm.phar --no-cache",
"psalm:update-baseline": "psalm.phar --threads=1 --update-baseline",
"psalm:update-baseline:force": "psalm.phar --threads=1 --update-baseline --set-baseline=tests/psalm-baseline.xml",
"post-install-cmd": [
"@composer bin all install --ansi",
"composer dump-autoload"
Expand Down
10 changes: 5 additions & 5 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 18 additions & 12 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
namespace OCA\OpenAi\AppInfo;

use OCA\OpenAi\Capabilities;
use OCA\OpenAi\SpeechToText\STTProvider;
use OCA\OpenAi\TextProcessing\FreePromptProvider;
use OCA\OpenAi\TextProcessing\HeadlineProvider;
use OCA\OpenAi\TextProcessing\ReformulateProvider;
use OCA\OpenAi\TextProcessing\SummaryProvider;
use OCA\OpenAi\TextToImage\TextToImageProvider;
use OCA\OpenAi\TaskProcessing\ContextWriteProvider;
use OCA\OpenAi\TaskProcessing\HeadlineProvider;
use OCA\OpenAi\TaskProcessing\ReformulateProvider;
use OCA\OpenAi\TaskProcessing\STTProvider;
use OCA\OpenAi\TaskProcessing\SummaryProvider;
use OCA\OpenAi\TaskProcessing\TextToImageProvider;
use OCA\OpenAi\TaskProcessing\TextToTextChatProvider;
use OCA\OpenAi\TaskProcessing\TextToTextProvider;
use OCA\OpenAi\TaskProcessing\TopicsProvider;
use OCA\OpenAi\Translation\TranslationProvider;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
Expand Down Expand Up @@ -73,17 +76,20 @@ public function register(IRegistrationContext $context): void {
$context->registerTranslationProvider(TranslationProvider::class);
}
if ($this->config->getAppValue(Application::APP_ID, 'stt_provider_enabled', '1') === '1') {
$context->registerSpeechToTextProvider(STTProvider::class);
$context->registerTaskProcessingProvider(STTProvider::class);
}

if ($this->config->getAppValue(Application::APP_ID, 'llm_provider_enabled', '1') === '1') {
$context->registerTextProcessingProvider(FreePromptProvider::class);
$context->registerTextProcessingProvider(SummaryProvider::class);
$context->registerTextProcessingProvider(HeadlineProvider::class);
$context->registerTextProcessingProvider(ReformulateProvider::class);
$context->registerTaskProcessingProvider(TextToTextProvider::class);
$context->registerTaskProcessingProvider(TextToTextChatProvider::class);
$context->registerTaskProcessingProvider(SummaryProvider::class);
$context->registerTaskProcessingProvider(HeadlineProvider::class);
$context->registerTaskProcessingProvider(TopicsProvider::class);
$context->registerTaskProcessingProvider(ContextWriteProvider::class);
$context->registerTaskProcessingProvider(ReformulateProvider::class);
}
if ($this->config->getAppValue(Application::APP_ID, 't2i_provider_enabled', '1') === '1') {
$context->registerTextToImageProvider(TextToImageProvider::class);
$context->registerTaskProcessingProvider(TextToImageProvider::class);
}

$context->registerCapability(Capabilities::class);
Expand Down
Loading
Loading