Nextcloud PHP API (master)

IManager

API surface for apps interacting with and making use of LanguageModel providers without known which providers are installed

Tags
since
27.1.0

Table of Contents

Methods

deleteTask()  : void
Delete a task that has been scheduled before
getAvailableTaskTypes()  : array<string|int, string>
getProviders()  : array<string|int, IProvider>
getTask()  : Task
getUserTask()  : Task
getUserTasksByApp()  : array<string|int, mixed>
hasProviders()  : bool
runOrScheduleTask()  : bool
If the designated provider for the passed task provides an expected average runtime, we check if the runtime fits into the max execution time of this php process and run it synchronously if it does, if it doesn't fit (or the provider doesn't provide that information) execution is deferred to a background job
runTask()  : string
scheduleTask()  : void
Will schedule an LLM inference process in the background. The result will become available with the \OCP\LanguageModel\Events\TaskSuccessfulEvent If inference fails a \OCP\LanguageModel\Events\TaskFailedEvent will be dispatched instead

Methods

deleteTask()

Delete a task that has been scheduled before

public deleteTask(Task $task) : void
Parameters
$task : Task

The task to delete

Tags
since
27.1.0

getAvailableTaskTypes()

public getAvailableTaskTypes() : array<string|int, string>
Tags
since
27.1.0
Return values
array<string|int, string>

getTask()

public getTask(int $id) : Task
Parameters
$id : int

The id of the task

Tags
throws
RuntimeException

If the query failed

throws
NotFoundException

If the task could not be found

since
27.1.0
Return values
Task

getUserTask()

public getUserTask(int $id, string|null $userId) : Task
Parameters
$id : int

The id of the task

$userId : string|null

The user id that scheduled the task

Tags
throws
RuntimeException

If the query failed

throws
NotFoundException

If the task could not be found

since
27.1.0
Return values
Task

getUserTasksByApp()

public getUserTasksByApp(string $userId, string $appId[, string|null $identifier = null ]) : array<string|int, mixed>
Parameters
$userId : string
$appId : string
$identifier : string|null = null
Tags
since
27.1.0
Return values
array<string|int, mixed>

hasProviders()

public hasProviders() : bool
Tags
since
27.1.0
Return values
bool

runOrScheduleTask()

If the designated provider for the passed task provides an expected average runtime, we check if the runtime fits into the max execution time of this php process and run it synchronously if it does, if it doesn't fit (or the provider doesn't provide that information) execution is deferred to a background job

public runOrScheduleTask(Task $task) : bool
Parameters
$task : Task

The task to schedule

Tags
returns

bool A boolean indicating whether the task was run synchronously (true) or offloaded to a background job (false)

throws
PreConditionNotMetException

If no or not the requested provider was registered but this method was still called

throws
TaskFailureException

If running the task failed

throws
Exception

storing the task in the database failed

since
28.0.0
Return values
bool

scheduleTask()

Will schedule an LLM inference process in the background. The result will become available with the \OCP\LanguageModel\Events\TaskSuccessfulEvent If inference fails a \OCP\LanguageModel\Events\TaskFailedEvent will be dispatched instead

public scheduleTask(Task $task) : void
Parameters
$task : Task

The task to schedule

Tags
throws
PreConditionNotMetException

If no or not the requested provider was registered but this method was still called

throws
Exception

storing the task in the database failed

since
27.1.0

        
On this page

Search results