You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: admin_manual/ai/app_context_chat.rst
+94-39
Original file line number
Diff line number
Diff line change
@@ -11,85 +11,75 @@ Context Chat is an :ref:`assistant<ai-app-assistant>` feature that is implemente
11
11
12
12
Together they provide the ContextChat text processing tasks accessible via the :ref:`Nextcloud Assistant app<ai-app-assistant>`.
13
13
14
-
The *context_chat* and *context_chat_backend* apps will use the Free text to text task processing providers like OpenAI integration, LLM2, etc. and such a provider is required on a fresh install, or it can be configured to run open source models entirely on-premises. Nextcloud can provide customer support upon request, please talk to your account manager for the possibilities.
14
+
The *context_chat* and *context_chat_backend* apps will use the Free text-to-text task processing providers like OpenAI integration, LLM2, etc. and such a provider is required on a fresh install, or it can be configured to run open source models entirely on-premises. Nextcloud can provide customer support upon request, please talk to your account manager for the possibilities.
15
15
16
-
This app supports input and output in the same languages that the currently configured Free text to text task processing provider supports.
16
+
This app supports input and output in the same languages that the currently configured Free text-to-text task processing provider supports.
17
17
18
18
Requirements
19
19
------------
20
20
21
21
* Minimal Nextcloud version: 30
22
-
* The *context_chat_backend* app is built as an External App and thus depends on AppAPI >= 2.7.0
23
22
* Nextcloud AIO is supported
24
23
* We currently support NVIDIA GPUs and x86_64 CPUs
25
24
* CUDA >= v12.2 on your host system
26
-
* GPU Sizing
25
+
* GPU Setup Sizing
27
26
28
-
* A NVIDIA GPU with at least 8GB VRAM
29
-
* At least 12GB of system RAM
27
+
* A NVIDIA GPU with at least 2GB VRAM
28
+
* The requirements for the Free text-to-text providers should be checked separately
29
+
* llm2's requirements can be found :ref:`here <ai-app-llm2>`
30
+
* integration_openai does not have any additional GPU requirements
31
+
* At least 8GB of system RAM
32
+
* 2 GB + additional 500MB for each concurrent request made to the backend if configuration parameters are changed
30
33
31
-
* CPU Sizing
34
+
* CPU Setup Sizing
32
35
33
36
* At least 12GB of system RAM
34
-
* This app makes use of the configured Text To Text Free prompt provider instead of running its own Language model, you will thus need only 4-8 cores for the embedding model
37
+
* 2 GB + additional 500MB for each request made to the backend if the Free text-to-text provider is not on the same machine
38
+
* 8 GB is recommended in the above case for the default settings
39
+
* This app makes use of the configured free text-to-text task processing provider instead of running its own language model by default, you will thus need 4+ cores for the embedding model only (backed configuration needs changes to make use of the extra cores, refer to `Configuration Options (Backend)`_)
35
40
36
41
* A dedicated machine is recommended
37
42
38
43
Space usage
39
44
~~~~~~~~~~~
40
45
41
-
This app employs a bundled Vector DB called `Chroma<https://github.com/chroma-core/chroma>`. All the users' textual data is duplicated, chunked and stored on disk in this vector DB along with semantic embedding vectors for the content.
42
-
43
-
Assuming no shared files between users you can calculate with roughly the amount of textual data in user files (e.g. for PDFs, only the text counts, no images are kept). Any shared files will be duplicated per user, however, so, assuming all files are shared with all users you need to calculate with "the amount of textual data in user files * number of users". The reality will lie between these two estimates, of course.
46
+
This app employs a bundled DB with Vector support called `PostgreSQL <https://www.postgresql.org/>`_. All the users' textual data is duplicated, chunked and stored on disk in this vector DB along with semantic embedding vectors for the content.
44
47
45
48
Installation
46
49
------------
47
50
48
-
0. Make sure the :ref:`Nextcloud Assistant app<ai-app-assistant>` is installed
49
-
1. :ref:`Install AppAPI and setup a Deploy Demon<ai-app_api>`
50
-
2. Install the *context_chat_backend* ExApp via the "External Apps" admin page in Nextcloud, or by executing
51
+
1. Make sure the :ref:`Nextcloud Assistant app<ai-app-assistant>` is installed
52
+
2. Setup a :ref:`Deploy Demon<ai-app_api>` in AppAPI Admin settings
53
+
3. Install the *context_chat_backend* ExApp via the "Apps" page in Nextcloud, or by executing (checkout the readme at https://github.com/nextcloud/context_chat_backend for manual install steps)
51
54
52
55
.. code-block::
53
56
54
57
occ app_api:app:register context_chat_backend
55
58
56
-
3. Install the *context_chat* app via the "Apps" page in Nextcloud, or by executing
59
+
4. Install the *context_chat* app via the "Apps" page in Nextcloud, or by executing
57
60
58
61
.. code-block::
59
62
60
63
occ app:enable context_chat
61
64
62
-
4. Install a text generation backend like *llm2* (via the "External Apps" page in Nextcloud) or *integration_openai* (via the "Apps" page in Nextcloud), or by executing
63
-
64
-
.. code-block::
65
-
66
-
occ app_api:app:register llm2
65
+
5. Install a text generation backend like :ref:`llm2 <ai-app-llm2>` or `integration_openai <https://github.com/nextcloud/integration_openai>`_ via the "Apps" page in Nextcloud
67
66
68
-
or
69
-
70
-
.. code-block::
71
-
72
-
occ app:enable integration_openai
73
-
74
-
75
-
5. Optionally but recommended, setup background workers for faster pickup of tasks. See :ref:`the relevant section in AI Overview<ai-overview_improve-ai-task-pickup-speed>` for more information.
67
+
6. Optionally but recommended, setup background workers for faster pickup of tasks. See :ref:`the relevant section in AI Overview<ai-overview_improve-ai-task-pickup-speed>` for more information.
76
68
77
69
**Note**: Both apps need to be installed and both major version and minor version of the two apps must match for the functionality to work (ie. "v1.3.4" and "v1.3.1"; but not "v1.3.4" and "v2.1.6"; and not "v1.3.4" and "v1.4.5"). Keep this in mind when updating.
78
70
71
+
79
72
Initial loading of data
80
73
-----------------------
81
74
82
-
Context chat will automatically load user data into the Vector DB using background jobs. To speed this up, you can set up multiple background job workers (possibly on dedicated machines) and run the following occ commands as daemons in parallel on each:
75
+
Context chat will automatically load user data into the Vector DB using background jobs. To speed this up, you can run the following command to index all documents for a user synchronously:
76
+
Note: This does not interact with the auto-indexing feature and that list would remain unchanged. However, the indexed files would be skipped when the auto indexer runs.
83
77
84
78
.. code-block::
85
79
86
-
set -e; while true; do sudo -u www-data occ background-job:worker -v -t 60 "OCA\ContextChat\BackgroundJobs\StorageCrawlJob"; done
80
+
occ context_chat:scan <user_id>
87
81
88
-
.. code-block::
89
-
90
-
set -e; while true; do sudo -u www-data occ background-job:worker -v -t 60 "OCA\ContextChat\BackgroundJobs\IndexerJob"; done
91
-
92
-
This will ensure that the necessary background jobs are run as often as possible: ``StorageCrawlJob`` will crawl Nextcloud storages and put files that it finds into a queue and ``IndexerJob`` will iterate over the queue and load the file content into the Vector DB.
82
+
To speed up the asynchronous indexing, see the `Configuration Options (OCC)`_.
93
83
94
84
See :ref:`the task speedup section in AI Overview<ai-overview_improve-ai-task-pickup-speed>` to know better ways to run these jobs.
95
85
@@ -110,11 +100,76 @@ You can find the app's code repository on GitHub where you can report bugs and c
110
100
111
101
Nextcloud customers should file bugs directly with our Customer Support.
112
102
103
+
Commands (OCC)
104
+
--------------
105
+
106
+
The options for each command can be found like this, using scan as example: ``context_chat:scan --help``
107
+
108
+
* ``context_chat:diagnostics``
109
+
Check currently running ContextChat background processes.
110
+
111
+
* ``context_chat:prompt``
112
+
Ask a question about your data, with options for selective context.
113
+
114
+
* ``context_chat:scan``
115
+
Scan and index the user's documents based on the user ID provided, synchronously.
116
+
117
+
* ``context_chat:stats``
118
+
|Shows the time taken to complete the initial indexing of the documents if it has finished,
119
+
|and the current no. of items in the indexer and actions queue.
120
+
|"Actions" refers to tasks like file deletions, ownership changes through share changes, etc.
121
+
|These file and ownership changes are synced with the backed through this actions queue.
122
+
123
+
124
+
Configuration Options (OCC)
125
+
---------------------------
126
+
127
+
* ``auto_indexing`` boolean (default: true)
128
+
To allow/disallow the IndexerJob from running in the background
Refer to `the Configuration head <https://github.com/nextcloud/context_chat_backend?tab=readme-ov-file#configuration>`_ in the backend's readme.
160
+
161
+
162
+
Possibility of Data Leak
163
+
------------------------
164
+
165
+
It is possible that some users who have been denied access to certain files/folders still have access to the content of those files/folders through the Context Chat app. We're working on a solution for this.
166
+
The users who never had access to a particular file/folder will NOT be able to see those contents in any way.
167
+
113
168
Known Limitations
114
169
-----------------
115
170
116
-
* Language models are likely to generate false information and should thus only be used in situations that are not critical. It's recommended to only use AI at the beginning of a creation process and not at the end, so that outputs of AI serve as a draft for example and not as final product. Always check the output of language models before using it.
171
+
* Language models are likely to generate false information and should thus only be used in situations that are not critical. It's recommended to only use AI at the beginning of a creation process and not at the end, so that outputs of AI serve as a draft for example and not as final product. Always check the output of language models before using it and make sure whether it meets your use-case's quality requirements.
117
172
* Context Chat is not integrated into the Chat UI of assistant app, at the moment, but has it's own interface in the assistant modal
118
-
* Make sure to test this app for whether it meets your use-case's quality requirements
119
-
* Customer support is available upon request, however we can't solve false or problematic output, most performance issues, or other problems caused by the underlying model. Support is thus limited only to bugs directly caused by the implementation of the app (connectors, API, front-end, AppAPI)
120
-
* Nextcloud usernames can be only 56 characters long. This is a limitation of the vector database we use (Chroma DB) and will be fixed soon.
173
+
* Customer support is available upon request, however we can't solve false or problematic output, most performance issues, or other problems caused by the underlying model. Support is thus limited only to bugs directly caused by the implementation of the app (connectors, API, front-end, AppAPI).
174
+
* Large files are not supported in "Selective context" in the Assistant UI if they have not been indexed before. Use ``occ context_chat:scan <user_id> -d <directory_path>`` to index the desired directory synchronously and then use the Selective context option. "Large files" could mean differently for different users. It depends on the amount of text inside the documents in question and the hardware on which the indexer is running. Generally 20 MB should be large for a CPU-backed setup and 100 MB for a GPU-backed system.
175
+
* Password protected PDFs or any other files are not supported. There will be error logs mentioning cryptography and AES in the docker container when such files are encountered but it is nothing to worry about, they will be simply ignored and the system will continue to function normally.
0 commit comments