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
+40-35Lines changed: 40 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,15 +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
26
* Both podman and docker are supported
27
27
* GPU Setup Sizing
28
28
29
-
* A NVIDIA GPU with at least 2GB VRAM
29
+
* A GPU with at least 2GB VRAM
30
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.
31
31
* At least 8GB of system RAM
32
32
* 2 GB + additional 500MB for each concurrent request made to the backend if configuration parameters are changed
@@ -66,7 +66,9 @@ Installation
66
66
67
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.
68
68
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.
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.
70
72
71
73
72
74
Initial loading of data
@@ -75,30 +77,11 @@ Initial loading of data
75
77
Auto-indexing
76
78
~~~~~~~~~~~~~
77
79
78
-
|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.
79
81
|The initial loading of data can take a long time depending on the number of files and their size.
80
82
81
-
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.
82
-
83
-
|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.
84
-
|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:
95
-
|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.
96
-
97
-
.. code-block::
98
-
99
-
occ context_chat:scan <user_id>
100
83
101
-
**Note**: The synchronous command could take several days to complete. On larger systems we thus recommend to use auto-indexing.
84
+
.. _scaling-context-chat:
102
85
103
86
Scaling
104
87
-------
@@ -119,23 +102,42 @@ Listed below are the major parts of the system that can be scaled independently
119
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.
120
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.
121
104
122
-
|Note that you cannot change the embedding model after installing the app, so if you want to use a different embedding model or service you will need to do a full uninstall (removing all data of the ExApp) and reinstall the ``context_chat_backend`` ExApp with the new environment variables and an empty vectorDB. If the vectorDB is external, the connected database (can be `ccb`) should be dropped before installing the ExApp again.
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';
123
122
124
-
One part of the system that cannot be scaled yet is the parsing of the documents to extract text.
125
-
This is currently done in a single instance of the ``context_chat_backend`` ExApp.
126
-
It is a CPU-bound task so having a powerful CPU will help speed up the parsing process.
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>`.
127
128
128
129
If ``context_chat_backend`` is already deployed, you can change these environment variables by redeploying it with the new values.
129
130
130
131
1. Go to Apps page -> search for "Context Chat Backend"
131
-
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)
132
133
3. Set the "Deploy Options" with the new environment variables
133
134
4. Reinstall the app
134
135
136
+
.. _kubernetes-context-chat:
135
137
136
138
Kubernetes
137
139
~~~~~~~~~~
138
-
Starting with version 5.4.0 of the app, Kubernetes is supported for deployment of the backend to scale ContextChat to large instances. Nextcloud customers can find details about Kubernetes deployment in the customer documentation or by contacting support.
140
+
Starting with version 5.4.0 of the app and Nextcloud 34, Kubernetes is supported for deployment of the backend to scale ContextChat to large instances. Nextcloud customers can find details about Kubernetes deployment in the customer documentation or by contacting support.
139
141
140
142
App store
141
143
---------
@@ -160,15 +162,16 @@ The options for each command can be found like this, using scan as example: ``co
160
162
* ``context_chat:search``
161
163
Perform a semantic (vector DB based) search on your indexed documents, with options for selective context.
162
164
163
-
* ``context_chat:scan``
164
-
Scan and index the user's documents based on the user ID provided, synchronously.
165
-
166
165
* ``context_chat:stats``
167
166
|Shows the time taken to complete the initial indexing of the documents if it has finished,
168
167
|and the current no. of items in the indexer and actions queue.
169
168
|"Actions" refers to tasks like file deletions, ownership changes through share changes, etc.
170
169
|These file and ownership changes are synced with the backed through this actions queue.
171
170
171
+
* ``context_chat:reindex``
172
+
|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.
0 commit comments