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: docs/features/ai-knowledge/prompts.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,7 +75,32 @@ Certain system variables like `{{prompt}}` and `{{MESSAGES}}` support optional m
75
75
***End Truncation**: `{{prompt:end:N}}` - Includes only the last **N** characters of the content.
76
76
***Middle Truncation**: `{{prompt:middletruncate:N}}` - Includes a total of **N** characters, taking half from the beginning and half from the end, with `...` in the middle.
77
77
78
-
These modifiers also work with the `{{MESSAGES}}` variable (e.g., `{{MESSAGES:START:5}}` to include only the first 5 messages).
78
+
These modifiers also work with the `{{MESSAGES}}` variable to control how many messages are included:
79
+
80
+
*`{{MESSAGES:START:5}}` - Includes only the first 5 messages.
81
+
*`{{MESSAGES:END:5}}` - Includes only the last 5 messages.
82
+
*`{{MESSAGES:MIDDLETRUNCATE:6}}` - Includes the first 3 and last 3 messages (split evenly).
In addition to selecting which messages to include, you can also truncate the **content of each individual message** using pipe filters. This is especially useful for task model prompts (title generation, tags, follow-ups) where conversations contain very long messages — for example, pasted documents or code. Truncating per-message content reduces latency for local models and API costs.
87
+
88
+
Pipe filters are appended after the message selector with a `|` character:
89
+
90
+
*`{{MESSAGES|middletruncate:500}}` - All messages, each truncated to 500 characters (keeping start and end with `...` in the middle).
91
+
*`{{MESSAGES|start:300}}` - All messages, each truncated to the first 300 characters.
92
+
*`{{MESSAGES|end:300}}` - All messages, each truncated to the last 300 characters.
93
+
94
+
Pipe filters can be combined with message selectors:
95
+
96
+
*`{{MESSAGES:END:2|middletruncate:500}}` - Last 2 messages, each truncated to 500 characters.
97
+
*`{{MESSAGES:START:5|start:200}}` - First 5 messages, each truncated to the first 200 characters.
98
+
99
+
:::tip
100
+
101
+
Using pipe filters on task model templates (title generation, tag generation, follow-up suggestions) is highly recommended for deployments that handle long conversations. For example, changing the title generation template to use `{{MESSAGES:END:2|middletruncate:500}}` prevents the task model from processing entire pasted documents just to generate a short title.
- Description: Specifies which vector database system to use. This setting determines which vector storage system will be used for managing embeddings.
1776
1776
@@ -2105,6 +2105,88 @@ If you use Multitenancy Mode, you should always check for any changes to the col
2105
2105
- Default: `open_webui`
2106
2106
- Description: Sets the prefix for Milvus collection names. In multitenancy mode, collections become `{prefix}_memories`, `{prefix}_knowledge`, etc. In legacy mode, collections are `{prefix}_{collection_name}`. Changing this value creates an entirely separate namespace—existing collections with the old prefix become invisible to Open WebUI but remain in Milvus consuming resources. Use this for true multi-instance isolation on a shared Milvus server, not for migration between modes. Milvus only accepts underscores, hyphens/dashes are not possible and will cause errors.
2107
2107
2108
+
### MariaDB Vector
2109
+
2110
+
:::warning
2111
+
2112
+
MariaDB Vector is not actively maintained by the Open WebUI team. It is an addition by the community and is maintained by the community.
2113
+
If you want to use MariaDB Vector, be careful when upgrading Open WebUI (create backups and snapshots for rollbacks) in case internal changes in Open WebUI lead to breakage.
2114
+
2115
+
:::
2116
+
2117
+
:::note
2118
+
2119
+
MariaDB Dependencies
2120
+
To use `mariadb-vector`, ensure you have the MariaDB connector and system library installed:
2121
+
2122
+
```bash
2123
+
pip install open-webui[mariadb]
2124
+
```
2125
+
2126
+
The Docker image includes `libmariadb-dev` by default. For non-Docker deployments, you must install the MariaDB C connector library (`libmariadb-dev` on Debian/Ubuntu) before installing the Python driver.
2127
+
2128
+
:::
2129
+
2130
+
:::info
2131
+
2132
+
MariaDB Vector requires the **official MariaDB connector** (`mariadb+mariadbconnector://...`) as the connection scheme. This is mandatory because the official driver provides the correct `qmark` paramstyle and proper binary binding for `VECTOR(n)` float32 payloads. Other MySQL-compatible drivers will not work.
2133
+
2134
+
Your MariaDB server must support `VECTOR` and `VECTOR INDEX` features (MariaDB 11.7+).
2135
+
2136
+
:::
2137
+
2138
+
#### `MARIADB_VECTOR_DB_URL`
2139
+
2140
+
- Type: `str`
2141
+
- Default: Empty string (`""`)
2142
+
- Description: Sets the database URL for MariaDB Vector storage. Must use the `mariadb+mariadbconnector://` scheme (official MariaDB driver).
- Description: Specifies the maximum vector length (number of dimensions) for the `VECTOR(n)` column. Must match the dimensionality of your embedding model. Once the table is created, changing this value requires data migration — the backend will refuse to start if the configured dimension differs from the stored column dimension.
2150
+
2151
+
#### `MARIADB_VECTOR_DISTANCE_STRATEGY`
2152
+
2153
+
- Type: `str`
2154
+
- Options:
2155
+
-`cosine` - Uses `vec_distance_cosine()` for similarity measurement.
2156
+
-`euclidean` - Uses `vec_distance_euclidean()` for similarity measurement.
2157
+
- Default: `cosine`
2158
+
- Description: Controls which distance function is used for the `VECTOR INDEX` and similarity search queries.
2159
+
2160
+
#### `MARIADB_VECTOR_INDEX_M`
2161
+
2162
+
- Type: `int`
2163
+
- Default: `8`
2164
+
- Description: HNSW index parameter that controls the maximum number of bi-directional connections per layer during index construction (`M=<int>` in the MariaDB `VECTOR INDEX` definition). Higher values improve recall but increase index size and build time.
2165
+
2166
+
#### `MARIADB_VECTOR_POOL_SIZE`
2167
+
2168
+
- Type: `int`
2169
+
- Default: `None`
2170
+
- Description: Sets the number of connections to maintain in the MariaDB Vector database connection pool. If not set, uses SQLAlchemy defaults. Setting this to `0` disables connection pooling entirely (uses `NullPool`).
2171
+
2172
+
#### `MARIADB_VECTOR_POOL_MAX_OVERFLOW`
2173
+
2174
+
- Type: `int`
2175
+
- Default: `0`
2176
+
- Description: Specifies the maximum number of connections that can be created beyond `MARIADB_VECTOR_POOL_SIZE` when the pool is exhausted.
2177
+
2178
+
#### `MARIADB_VECTOR_POOL_TIMEOUT`
2179
+
2180
+
- Type: `int`
2181
+
- Default: `30`
2182
+
- Description: Sets the timeout in seconds for acquiring a connection from the MariaDB Vector pool.
2183
+
2184
+
#### `MARIADB_VECTOR_POOL_RECYCLE`
2185
+
2186
+
- Type: `int`
2187
+
- Default: `3600`
2188
+
- Description: Specifies the time in seconds after which connections are recycled in the MariaDB Vector pool to prevent stale connections.
2189
+
2108
2190
### OpenSearch
2109
2191
2110
2192
#### `OPENSEARCH_CERT_VERIFY`
@@ -4916,8 +4998,17 @@ See https://open.feishu.cn/document/sso/web-application-sso/login-overview
4916
4998
The environment variable `OPENID_PROVIDER_URL` MUST be configured, otherwise the logout functionality will not work for most providers.
4917
4999
Even when using Microsoft, GitHub or other providers, you MUST set the `OPENID_PROVIDER_URL` environment variable.
4918
5000
5001
+
Alternatively, if your provider does not support standard OIDC discovery (e.g., AWS Cognito), you can set `OPENID_END_SESSION_ENDPOINT` to a custom logout URL instead.
5002
+
4919
5003
:::
4920
5004
5005
+
#### `OPENID_END_SESSION_ENDPOINT`
5006
+
5007
+
- Type: `str`
5008
+
- Default: Empty string (`""`)
5009
+
- Description: Sets a custom end-session (logout) endpoint URL. When configured, Open WebUI will redirect to this URL on logout instead of attempting OIDC discovery via `OPENID_PROVIDER_URL`. This is useful for OAuth providers that do not support standard OIDC discovery for logout, such as AWS Cognito.
5010
+
- Persistence: This environment variable is a `PersistentConfig` variable.
0 commit comments