-
Notifications
You must be signed in to change notification settings - Fork 260
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 from textProcessing to taskProcessing #10042
Comments
is this a breaking change? |
The textProcessing API will stay one or two major NC versions. But the apps that implement providers have migrated to taskProcessing (or will do soon). So you might run out of providers. I guess that can be considered as a breaking change. |
I see. This is very unfortunate to announce after feature freeze and branch-off. |
@julien-nc what is the replacement for |
You can get the task ID right after having scheduled it: $this->taskProcessingManager->scheduleTask($task);
$taskId = $task->getId(); The tasks can't run synchronously anymore because many providers may take too long and it's possible to reach the Php process timeout. Tasks are processed in background jobs (which can be fast if The If you want to still do something similar than $task = $this->taskProcessingManager->getTask($taskId);
if ($task->getStatus() === Task::STATUS_SUCCESSFUL) {
// do something with the result
} |
Is there a solution without this? Unfortunately I can't assume that every Nextcloud installation has this process running |
If this is not running, the taskProcessing jobs run when |
To elaborate why Mail uses the synchronous mode fully intentionally: want to process emails as late as possible when the user opens them, but then show the results right away. Hope this makes sense. |
A well configured system has cron set up for a 5m interval. Some older system still use 15m, tiny setup use irregular ajax cron. |
If the Mail frontend sends a synchronous request to the server which blocks until the task has finished (with textProcessing or with taskProcessing), it blocks a Php runner so it can have an impact on the general server performance. Also this Php process might always get killed if it's too long and no result can ever be produced. That's why tasks are now always processed in bg jobs. Running the occ bg job worker is strongly recommended to be able to run AI tasks with no delay. |
We target only openai for our integration (the rest is too slow), so the process is mostly IO bound when it waits for the API response. The blocked request is OK for us. I get the general push towards async processing for tasks of unknown complexity, though. |
The local LLM2 is now equally fast and could be potentially used also (although we did not run tests on large texts). |
One more detail: the occ bg job worker only runs tasks for which the responsible provider is implemented in a Php app. |
@DaphneMuller nice! I'll still have to wait 5-15 minutes for the result when the special worker process is not running, right? |
Like mentioned before, not if the provider is LLM2 (which is an external application). |
Then I misread. @julien-nc do you have some example code for getting synchronous-ish results from LLM2 without the use of occ background-job:worker "OC\TaskProcessing\SynchronousBackgroundJob"? In my understanding the LLM processing would not happen until the next cron execution. |
With or without the worker, you can schedule a task and immediately start checking if it's finished or not (in the frontend or in the backend, as you wish). |
We can also keep the providers for the old APIs in integration_openai and the features in Mail are not broken. |
That's the best solution right now because it means we can branch-off Mail for the upcoming release |
This is done and will be included in the next integration_openai release. |
Two things should make it more convenient:
All this is in stable30 already. |
There is a new API to run the AI tasks. It is slightly different than the old one.
As Mail is using Summary, Topics and FreePrompt, it should be relatively straightforward to migrate to the taskProcessing API.
More information there: nextcloud/assistant#114
cc @hamza221 @st3iny
The text was updated successfully, but these errors were encountered: