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
+41-34Lines changed: 41 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,14 +18,15 @@ This app supports input and output in the same languages that the currently conf
18
18
Requirements
19
19
------------
20
20
21
-
* Minimal Nextcloud version: 30
21
+
* Minimal Nextcloud version: 32
22
22
* Nextcloud AIO is supported
23
-
* We currently support NVIDIA GPUs and x86_64 CPUs
23
+
* We currently support NVIDIA GPUs, AMD GPUs (via Vulkan) and x86_64 CPUs
24
24
* CPU that supports AVX and AVX2 instruction
25
-
* CUDA >= v12.2 on your host system
25
+
* CUDA >= v12.8 on your host system if NVIDIA GPUs are used
26
+
* Both podman and docker are supported
26
27
* GPU Setup Sizing
27
28
28
-
* A NVIDIA GPU with at least 2GB VRAM
29
+
* A GPU with at least 2GB VRAM
29
30
* The requirements for the text-to-text providers should be checked separately for each app :ref:`here <tp-consumer-apps>` in the "Backend apps" section, as they can vary greatly based on the model used and whether the provider is hosted locally or remotely.
30
31
* At least 8GB of system RAM
31
32
* 2 GB + additional 500MB for each concurrent request made to the backend if configuration parameters are changed
@@ -65,7 +66,9 @@ Installation
65
66
66
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.
67
68
68
-
**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.
69
+
.. note::
70
+
71
+
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.
69
72
70
73
71
74
Initial loading of data
@@ -74,30 +77,11 @@ Initial loading of data
74
77
Auto-indexing
75
78
~~~~~~~~~~~~~
76
79
77
-
|Context chat will automatically load user data into the Vector DB using asynchronous background jobs.
80
+
|Context chat will automatically load user data into the Vector DB. Context chat backend pulls the queued files and content providers' items from the context chat PHP app and indexes them.
78
81
|The initial loading of data can take a long time depending on the number of files and their size.
79
82
80
-
The indexing jobs are set up to run during the Nextcloud instance's maintenance window (typically during the night) only. If you have not set a maintenance window, indexing will run 24/7.
81
-
82
-
|You can set up a separate cron job to run every 30 minutes for Context Chat to avoid slowing down normal background job operation on larger instances.
83
-
|The following command can bypass the maintenance window so it can either be set to run during the day even with a maintenance window set, or it can be set to run during the weekends 24/7 to speed up the indexing process.
|To index all the files synchronously, use the following command:
94
-
|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.
95
-
96
-
.. code-block::
97
-
98
-
occ context_chat:scan <user_id>
99
83
100
-
**Note**: The synchronous command could take several days to complete. On larger systems we thus recommend to use auto-indexing.
84
+
.. _scaling-context-chat:
101
85
102
86
Scaling
103
87
-------
@@ -118,17 +102,38 @@ Listed below are the major parts of the system that can be scaled independently
118
102
|The embedding model performance can be scaled by using a hosted embedding service, locally or remotely hosted. It should be able to serve an OpenAI-compatible API.
119
103
|The embedding service URL can be set using the environment variable ``CC_EM_BASE_URL`` during deployment in the "Deploy Options". Other options like the model name, api key, or username and password can be set using the environment variables ``CC_EM_MODEL_NAME``, ``CC_EM_API_KEY``, ``CC_EM_USERNAME``, and ``CC_EM_PASSWORD`` respectively.
120
104
121
-
One part of the system that cannot be scaled yet is the parsing of the documents to extract text.
122
-
This is currently done in a single instance of the ``context_chat_backend`` ExApp.
123
-
It is a CPU-bound task so having a powerful CPU will help speed up the parsing process.
105
+
.. warning::
106
+
107
+
The embedding model cannot be changed after installing the app. To use a different embedding model or service, you
108
+
will need to do a full uninstall (removing all data of the ExApp) and reinstall the ``context_chat_backend`` ExApp
109
+
with the new environment variables and an empty vector DB. If the vector DB is external, the connected database
110
+
(database may be named ``ccb``) should be dropped before installing the ExApp again.
111
+
112
+
For the ``context_chat`` app, obtain a clean slate by dropping all the ``<PREFIX>_context_chat_*`` tables in the database, and removing all the config values:
113
+
And re-installing it.
114
+
115
+
.. code-block:: sql
116
+
117
+
drop table if exists oc_context_chat_action_queue;
118
+
drop table if exists oc_context_chat_content_queue;
119
+
drop table if exists oc_context_chat_fs_events;
120
+
drop table if exists oc_context_chat_queue;
121
+
delete from oc_appconfig where appid = 'context_chat';
122
+
123
+
124
+
4. The parsing of the documents to extract text
125
+
126
+
|The parsing of the documents to extract text is done in a single instance of the ``context_chat_backend`` ExApp in a docker-based environment. It is a CPU-bound task, so having a powerful CPU will help speed up the parsing process.
127
+
|This can be scaled by using Kubernetes for deployment, allowing multiple instances of the ``context_chat_backend`` ExApp to handle the parsing concurrently, see :ref:`the Kubernetes section <kubernetes-context-chat>`.
124
128
125
129
If ``context_chat_backend`` is already deployed, you can change these environment variables by redeploying it with the new values.
126
130
127
131
1. Go to Apps page -> search for "Context Chat Backend"
128
-
2. Disable and remove the app taking care the data is not removed
132
+
2. Disable and remove the app taking care the data is not removed (except when the embedding model is changed, in which case the data should be removed)
129
133
3. Set the "Deploy Options" with the new environment variables
130
134
4. Reinstall the app
131
135
136
+
.. _kubernetes-context-chat:
132
137
133
138
App store
134
139
---------
@@ -153,15 +158,16 @@ The options for each command can be found like this, using scan as example: ``co
153
158
* ``context_chat:search``
154
159
Perform a semantic (vector DB based) search on your indexed documents, with options for selective context.
155
160
156
-
* ``context_chat:scan``
157
-
Scan and index the user's documents based on the user ID provided, synchronously.
158
-
159
161
* ``context_chat:stats``
160
162
|Shows the time taken to complete the initial indexing of the documents if it has finished,
161
163
|and the current no. of items in the indexer and actions queue.
162
164
|"Actions" refers to tasks like file deletions, ownership changes through share changes, etc.
163
165
|These file and ownership changes are synced with the backed through this actions queue.
164
166
167
+
* ``context_chat:reindex``
168
+
|Schedule a full re-crawl of all the files in all the mounts. Indexed files are not re-indexed when compared against context_chat_backend's vector DB.
Context chat backend's configuration options are available through the environment variable in :ref:`Deploy Options <ai-app_api_deploy_options>`.
184
+
177
185
Logs
178
186
----
179
187
@@ -206,5 +214,4 @@ Known Limitations
206
214
* 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).
207
215
* Files larger than 100MB are not supported
208
216
* 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.
209
-
* Podman and Kubernetes are currently not supported for the Context Chat Backend ExApp.
210
217
* External storages (through ``files_external``) may not work as well as the local storage.
0 commit comments