|
| 1 | +===================== |
| 2 | +Insight and debugging |
| 3 | +===================== |
| 4 | + |
| 5 | +.. _ai-insight-and-debugging: |
| 6 | + |
| 7 | +In order to gain insights and debug AI tasks, there are a number of occ commands |
| 8 | +available in the `taskprocessing` namespace. |
| 9 | + |
| 10 | +All commands listed here accept an `--output` parameter that can be set to `plain`, `json` or `json_pretty`. |
| 11 | + |
| 12 | +Tasks are retained in the database for 6 months. Note, however, that there is no strict write-only guarantee for these logs. |
| 13 | +This means Nextcloud will not change the task logs in the database once the task has ended, but any administrator with database access |
| 14 | +has the power to change them. |
| 15 | + |
| 16 | +Get a task by id |
| 17 | +---------------- |
| 18 | + |
| 19 | +.. code-block:: |
| 20 | +
|
| 21 | + $ occ taskprocessing:task:get <task-id> |
| 22 | +
|
| 23 | +For example |
| 24 | + |
| 25 | +.. code-block:: |
| 26 | +
|
| 27 | + $ occ taskprocessing:task:get --output=json_pretty 42 |
| 28 | + { |
| 29 | + "id": 1, |
| 30 | + "type": "core:text2text:chat", |
| 31 | + "lastUpdated": 1759739466, |
| 32 | + "status": "STATUS_SUCCESSFUL", |
| 33 | + "userId": "admin", |
| 34 | + "appId": "assistant:chatty-llm", |
| 35 | + "input": { |
| 36 | + "system_prompt": "This is a conversation in a specific language between the user and you, Nextcloud Assistant. You are a kind, polite and helpful AI that helps the user to the best of its abilities. If you do not understand something, you will ask for clarification. Detect the language that the user is using. Make sure to use the same language in your response. Do not mention the language explicitly.", |
| 37 | + "input": "What's the weather in Berlin today?", |
| 38 | + "history": [] |
| 39 | + }, |
| 40 | + "output": { |
| 41 | + "output": "I'm happy to help, but I'm a large language model, I don't have real-time access to current weather conditions. However, I can suggest checking a reliable weather website or app, such as AccuWeather or OpenWeatherMap, for the most up-to-date information on the weather in Karlsruhe today. Would you like me to help with anything else?" |
| 42 | + }, |
| 43 | + "customId": "chatty-llm:1", |
| 44 | + "completionExpectedAt": 1759739513, |
| 45 | + "progress": 1, |
| 46 | + "scheduledAt": 1759739453, |
| 47 | + "startedAt": 1759739455, |
| 48 | + "endedAt": 1759739466, |
| 49 | + "allowCleanup": true, |
| 50 | + "error_message": null |
| 51 | + } |
| 52 | +
|
| 53 | +Each task has the following fields: |
| 54 | + |
| 55 | + * `id` The internal ID of the task, also referenced in user-facing error messages in case something goes wrong |
| 56 | + * `type` The type of the task |
| 57 | + * `status` The current status of the task (can be either `"STATUS_CANCELLED"`, `"STATUS_FAILED"`, `"STATUS_SUCCESSFUL"`, `"STATUS_SCHEDULED"`, `"STATUS_RUNNING"`, or `"STATUS_UNKNOWN"`) |
| 58 | + * `userId` The Id of the user who requested the task |
| 59 | + * `lastUpdated` When the task was last updated |
| 60 | + * `scheduledAt` When the task was scheduled/created |
| 61 | + * `startedAt` When the task was started to be processed by the set task processing provider |
| 62 | + * `completionExpectedAt` When the system expects/expected the task to be finished |
| 63 | + * `endedAt` When the task finished be it successfully or unsuccessfully |
| 64 | + * `appid` The ID of the app that scheduled the task |
| 65 | + * `input` The values that were part of the task input |
| 66 | + * `output` The values that were part of the task output |
| 67 | + * `error_message` The error message in case the task failed |
| 68 | + |
| 69 | +List and filter tasks |
| 70 | +--------------------- |
| 71 | + |
| 72 | +.. code-block:: |
| 73 | +
|
| 74 | + $ occ taskprocessing:task:list [options] |
| 75 | +
|
| 76 | + -u, --userIdFilter[=USERIDFILTER] only get the tasks for one user ID |
| 77 | + -t, --type[=TYPE] only get the tasks for one task type |
| 78 | + --appId[=APPID] only get the tasks for one app ID |
| 79 | + --customID[=CUSTOMID] only get the tasks for one custom ID |
| 80 | + -s, --status[=STATUS] only get the tests that have a specific status |
| 81 | + --scheduledAfter[=SCHEDULEDAFTER] only get the tasks that were scheduled after a specific date (Unix timestamp) |
| 82 | + --endedBefore[=ENDEDBEFORE] only get the tasks that ended before a specific date (Unix timestamp) |
| 83 | +
|
| 84 | +
|
| 85 | +For example |
| 86 | + |
| 87 | +.. code-block:: |
| 88 | +
|
| 89 | + $ occ taskprocessing:task:list --output=json_pretty --status=3 --scheduledAfter=1759740266 --endedBefore=1759743900 |
| 90 | + [ |
| 91 | + { |
| 92 | + ... |
| 93 | + } |
| 94 | + ] |
0 commit comments