Skip to content

Commit f8a47ed

Browse files
authored
Merge pull request #1138 from open-webui/dev
2 parents f14af2e + b3e5ea6 commit f8a47ed

File tree

2 files changed

+118
-2
lines changed

2 files changed

+118
-2
lines changed

docs/features/ai-knowledge/prompts.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,32 @@ Certain system variables like `{{prompt}}` and `{{MESSAGES}}` support optional m
7575
* **End Truncation**: `{{prompt:end:N}}` - Includes only the last **N** characters of the content.
7676
* **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.
7777

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).
83+
84+
#### Per-Message Content Truncation (Pipe Filters)
85+
86+
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.
102+
103+
:::
79104

80105
---
81106

docs/reference/env-configuration.mdx

Lines changed: 92 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1770,7 +1770,7 @@ modeling files for reranking.
17701770

17711771
- Type: `str`
17721772
- Options:
1773-
- `chroma`, `elasticsearch`, `milvus`, `opensearch`, `pgvector`, `qdrant`, `pinecone`, `s3vector`, `oracle23ai`, `weaviate`
1773+
- `chroma`, `elasticsearch`, `mariadb-vector`, `milvus`, `opensearch`, `pgvector`, `qdrant`, `pinecone`, `s3vector`, `oracle23ai`, `weaviate`
17741774
- Default: `chroma`
17751775
- Description: Specifies which vector database system to use. This setting determines which vector storage system will be used for managing embeddings.
17761776

@@ -2105,6 +2105,88 @@ If you use Multitenancy Mode, you should always check for any changes to the col
21052105
- Default: `open_webui`
21062106
- 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.
21072107

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).
2143+
- Example: `mariadb+mariadbconnector://user:password@localhost:3306/openwebui`
2144+
2145+
#### `MARIADB_VECTOR_INITIALIZE_MAX_VECTOR_LENGTH`
2146+
2147+
- Type: `int`
2148+
- Default: `1536`
2149+
- 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+
21082190
### OpenSearch
21092191

21102192
#### `OPENSEARCH_CERT_VERIFY`
@@ -4916,8 +4998,17 @@ See https://open.feishu.cn/document/sso/web-application-sso/login-overview
49164998
The environment variable `OPENID_PROVIDER_URL` MUST be configured, otherwise the logout functionality will not work for most providers.
49174999
Even when using Microsoft, GitHub or other providers, you MUST set the `OPENID_PROVIDER_URL` environment variable.
49185000

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+
49195003
:::
49205004

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.
5011+
49215012
#### `OPENID_REDIRECT_URI`
49225013

49235014
- Type: `str`

0 commit comments

Comments
 (0)