Skip to content

Commit c27170f

Browse files
authored
Merge pull request #15471 from nextcloud/fix/admin/ai/context-chat-update
fix(Admin/AI/ContextChat): update latest info
2 parents db7c13a + 04aee72 commit c27170f

1 file changed

Lines changed: 40 additions & 35 deletions

File tree

admin_manual/ai/app_context_chat.rst

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ This app supports input and output in the same languages that the currently conf
1818
Requirements
1919
------------
2020

21-
* Minimal Nextcloud version: 30
21+
* Minimal Nextcloud version: 32
2222
* 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
2424
* 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
2626
* Both podman and docker are supported
2727
* GPU Setup Sizing
2828

29-
* A NVIDIA GPU with at least 2GB VRAM
29+
* A GPU with at least 2GB VRAM
3030
* 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.
3131
* At least 8GB of system RAM
3232
* 2 GB + additional 500MB for each concurrent request made to the backend if configuration parameters are changed
@@ -66,7 +66,9 @@ Installation
6666

6767
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.
6868

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.
7072

7173

7274
Initial loading of data
@@ -75,30 +77,11 @@ Initial loading of data
7577
Auto-indexing
7678
~~~~~~~~~~~~~
7779

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.
7981
| The initial loading of data can take a long time depending on the number of files and their size.
8082
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.
85-
86-
.. code-block::
87-
88-
php cron.php "OCA\\ContextChat\\BackgroundJobs\\IndexerJob" "OCA\\ContextChat\\BackgroundJobs\\ActionJob" "OCA\\ContextChat\\BackgroundJobs\\SubmitContentJob" "OCA\\ContextChat\\BackgroundJobs\\StorageCrawlJob" "OCA\\ContextChat\\BackgroundJobs\\InitialContentImportJob"
89-
90-
91-
Synchronous indexing
92-
~~~~~~~~~~~~~~~~~~~~
93-
94-
| 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>
10083

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:
10285

10386
Scaling
10487
-------
@@ -119,23 +102,42 @@ Listed below are the major parts of the system that can be scaled independently
119102
| 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.
120103
| 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.
121104
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';
123122
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>`.
127128
128129
If ``context_chat_backend`` is already deployed, you can change these environment variables by redeploying it with the new values.
129130

130131
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)
132133
3. Set the "Deploy Options" with the new environment variables
133134
4. Reinstall the app
134135

136+
.. _kubernetes-context-chat:
135137

136138
Kubernetes
137139
~~~~~~~~~~
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.
139141

140142
App store
141143
---------
@@ -160,15 +162,16 @@ The options for each command can be found like this, using scan as example: ``co
160162
* ``context_chat:search``
161163
Perform a semantic (vector DB based) search on your indexed documents, with options for selective context.
162164

163-
* ``context_chat:scan``
164-
Scan and index the user's documents based on the user ID provided, synchronously.
165-
166165
* ``context_chat:stats``
167166
| Shows the time taken to complete the initial indexing of the documents if it has finished,
168167
| and the current no. of items in the indexer and actions queue.
169168
| "Actions" refers to tasks like file deletions, ownership changes through share changes, etc.
170169
| These file and ownership changes are synced with the backed through this actions queue.
171170
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.
173+
| Content providers are not re-indexed.
174+
172175

173176
Configuration Options
174177
---------------------
@@ -181,6 +184,8 @@ Configuration Options
181184
occ config:app:set context_chat auto_indexing --value='true' --type=string
182185
183186
187+
Context chat backend's configuration options are available through the environment variable in :ref:`Deploy Options <ai-app_api_deploy_options>`.
188+
184189
Logs
185190
----
186191

0 commit comments

Comments
 (0)