144 Commits
Author SHA1 Message Date
Timothy Jaeryang Baek 243ef36c49 refac 2026-10-21 09:53:09 +09:00
Classic298 794e57cf7e fix: misleading ask_user error when questions are not sent as a list (#32727)
When a model sent the ask_user questions as anything other than a list, for example a JSON-encoded string, the tool answered "ask_user requires 1-3 questions." The model had sent the right number of questions, so it did not understand the error and often repeated the same call in a loop. It now gets a separate error saying the questions must be an array of question objects, and the count error only appears when the count is actually wrong.

Fixes #32662
2026-10-21 03:33:10 +09:00
Timothy Jaeryang Baek 92e64c1d59 refac 2026-10-16 14:31:39 +04:00
Timothy Jaeryang Baek 7b47c3b22c refac 2026-10-14 23:21:22 +04:00
Timothy Jaeryang Baek c314239558 refac 2026-10-14 17:10:08 +04:00
Timothy Jaeryang Baek 2e8839a5dd refac 2026-10-13 19:40:48 +04:00
Timothy Jaeryang Baek d34f73066d refac 2026-10-13 19:10:21 +04:00
Timothy Jaeryang Baek 200b951491 refac 2026-10-13 18:31:54 +04:00
Timothy Jaeryang Baek fc1005f09b refac 2026-10-13 18:16:01 +04:00
Classic298 1369027db6 fix: external knowledge citation links lead to a not found error (#32233)
Clicking the title of a citation from an external knowledge base (Qdrant, Milvus, pgvector), or its Content link, opened a link to a file inside Open WebUI that does not exist, so the browser showed a not found error. These results are no longer treated as uploaded files, so when the citation's source is a web address both links open that page, and otherwise the title is plain text. This works whether or not the model uses native tool calling.

Fixes https://github.com/open-webui/open-webui/issues/32231
2026-10-12 11:57:07 +04:00
Timothy Jaeryang Baek 6affee4fce refac 2026-10-10 23:38:22 +04:00
Timothy Jaeryang BaekandTaylor Wilsdon 088830cf82 feat: Dynamic Tool Loading / Lazy Loading
Co-Authored-By: Taylor Wilsdon <6508528+taylorwilsdon@users.noreply.github.com>
2026-10-10 22:43:52 +04:00
G30 94e9c7fef9 fix: show a knowledge file's current name in citations after it is renamed (#31860) 2026-10-10 20:44:43 +04:00
Timothy Jaeryang Baek d3acc2706d refac 2026-10-10 01:28:36 +04:00
Timothy Jaeryang Baek 9bbb95048b refac 2026-10-09 15:07:43 +04:00
Classic298 c04c7ddae0 fix: reranker gets no user info headers in chat and knowledge search (#32061)
With ENABLE_FORWARD_USER_INFO_HEADERS on and hybrid search enabled, rerank requests went out without the user headers when a chat searched attached knowledge, when a model used the built-in knowledge search tool, and when the collection query API was called with hybrid turned off for that one request. The embedding requests of the same search did carry them, so external rerankers that use these headers for per-user auth, rate limits or auditing saw anonymous calls. Rerank requests now carry the signed-in user, the same as embedding requests.

Fixes #32060
2026-10-08 16:55:45 +04:00
Timothy Jaeryang Baek d4c561d9f2 refac 2026-10-05 14:01:02 +04:00
Classic298 52533c5675 refac: calendar event tools use the calendar's access check (#31537)
Editing or deleting a calendar event through the chat tools now checks access to the event's calendar the same way the calendar API does.
2026-09-30 19:29:19 +04:00
Timothy Jaeryang Baek 7ad0ae4687 refac 2026-09-24 12:34:04 -04:00
Timothy Jaeryang Baek 5fb869db22 refac 2026-09-21 08:59:39 -04:00
Timothy Jaeryang Baek 97e013a661 refac 2026-09-21 00:51:28 -04:00
Classic298 7fa705f3b8 feat: let operators expose chosen file metadata to the model in retrieved sources (#29696)
Custom metadata attached to a file upload now reaches the vector DB, but the model still never sees it. Both prompt-assembly paths build their output from a fixed field set: the classic RAG <source> tag carries only id, name and resource type, and the retrieval tools return only content, source and file id per chunk. A scraper that records where each document came from therefore cannot get that origin in front of the model, so answers cannot state it.

RAG_SOURCE_METADATA_KEYS names the chunk metadata keys allowed through to the model. Configured keys are emitted as extra attributes on the <source> tag and as extra fields on tool result chunks, covering both retrieval paths. It is empty by default, so nothing changes for existing deployments.

An allowlist instead of passing everything through, because chunk metadata also carries file hashes, collection names, embedding config and relevance scores, which would then be added to every retrieved chunk of every request. Values are attacker-controllable through an uploaded file, so they are escaped before they go into the tag, and a configured key can never displace a field the tag or the chunk already defines.

Reported in open-webui/open-webui#29486.
2026-09-19 17:02:59 -05:00
Classic298 1f8f1f61bb fix: tell ask_user models that the first option is shown as Recommended (#30196)
The ask_user card badges the first option of every question as "Recommended", but nothing ever told the model that. The model picks whatever order it likes, so the badge really means "listed first" and users act on a recommendation the model never made.

The ask_user tool description now states that the first option is labelled Recommended and that the model should list the option it recommends first, so the badge reflects an actual choice.

Kept the badge and instructed the model instead of adding a per-option "recommended" flag: the flag would need a schema change, validation in the request normalizer and a frontend change, for the same result in the common case. Dropping the badge was the other option, but it removes a useful affordance rather than fixing it.

Verified that the added line reaches the model by running the docstring through the tool-spec builder and checking the generated OpenAI function schema.

Fixes #30195
2026-09-19 09:59:18 -05:00
Classic298 3d6598fccb fix: steer models to replace_range in the replace_note_content tool description (#30048)
Asked to add a section or change a few lines, models answer with a whole-note
replace_note_content call and the rest of the note is gone, with nothing to
undo because the editor only records versions on chat inserts. The tool
already supports replace_range operations with an expected guard, but its
description never said when to use them or how the offsets work, so models
defaulted to sending the whole note back.

The docstring, which is the description every model receives for this tool
in note chats and normal chats alike, now states the preference for range
edits and the offset, overlap and expected rules the handler enforces.
Verified the text lands in the generated tool spec unchanged and that range
edits, the expected mismatch rejection and whole-note replace behave as
described against a sqlite data dir.
2026-09-15 22:51:49 -04:00
Timothy Jaeryang Baek e69236bccb refac 2026-09-13 23:33:22 -04:00
Classic298 82f11b14c9 refac: run the built-in file grep off the event loop (#29621)
The built-in chat and knowledge grep tools awaited their matching helper directly, so the search ran on the event loop and held it for as long as the match took. Both call sites now hand the helper to a worker thread.

Output and error handling are unchanged: 17 cases (literal, regex, case-insensitive, count-only, no-match, invalid pattern, rejected quantifiers, missing file data, result truncation) compare byte-for-byte against the previous behaviour. The matcher's time budget lives in a contextvar, which asyncio.to_thread copies into the worker, so budget scoping still behaves as before.
2026-09-04 11:41:06 -04:00
Timothy Jaeryang Baek aeb126b95d refac 2026-08-30 23:46:02 -04:00
Timothy Jaeryang Baek 5c62cc0517 chore: format 2026-08-25 16:53:53 -04:00
Timothy Jaeryang Baek 9550731cc1 refac 2026-08-17 00:24:47 -07:00
Damien SandDamien SPINELLI 54cefd2b99 fix: preserve complete user context in agentic retrieval (#27642)
* fix: preserve user info in agentic RAG tools

* fix: preserve user info in file access checks

---------

Co-authored-by: Damien SPINELLI <damien.spinelli@external.list.lu>
2026-08-17 00:56:48 -06:00
Timothy Jaeryang Baek 133549a87e refac 2026-08-13 18:19:25 -06:00
Timothy Jaeryang Baek 4465f52a3e refac 2026-08-13 18:13:43 -06:00
Timothy Jaeryang Baek 2649e3305c refac 2026-08-13 16:42:10 -06:00
Timothy Jaeryang Baek 90bb94abf9 refac 2026-08-12 18:13:47 -06:00
G30 1deeaf71da fix: stop the calendar update tool from nulling every omitted field (#27777) 2026-08-12 01:09:07 -06:00
Timothy Jaeryang Baek 5ec16e76e6 refac 2026-08-10 20:13:03 -06:00
Timothy Jaeryang Baek 0800c21c64 refac 2026-08-05 00:47:49 -05:00
Timothy Jaeryang Baek bb0f898b43 refac 2026-07-31 17:41:14 -04:00
Timothy Jaeryang Baek 810378c0b8 refac 2026-07-27 19:39:36 -04:00
Timothy Jaeryang Baek c004b4ecb5 chore: format 2026-07-27 04:38:46 -04:00
Timothy Jaeryang BaekandClassic298 11e61b69eb refac
Co-Authored-By: Classic298 <27028174+Classic298@users.noreply.github.com>
2026-07-27 04:00:46 -04:00
Timothy Jaeryang BaekandJacob Leksan 312d8a8e7f refac
Co-Authored-By: Jacob Leksan <63938553+jmleksan@users.noreply.github.com>
2026-07-27 02:17:11 -04:00
Timothy Jaeryang Baek c4f5ac65ee refac 2026-07-27 01:59:17 -04:00
Timothy Jaeryang Baek 57e60423b9 refac 2026-07-27 00:27:38 -04:00
Timothy Jaeryang Baek d484a2a99e refac 2026-07-26 21:07:20 -04:00
Timothy Jaeryang Baek f798d05586 refac 2026-07-26 19:34:41 -04:00
Classic298 076a84e3f0 fix: enforce automation limits in the builtin automation tools (#27523)
The `create_automation` and `update_automation` builtin tools wrote straight to `Automations.insert` / `Automations.update_by_id`, skipping the limit checks that `/api/v1/automations/create` and `/api/v1/automations/{id}/update` run through `check_automation_limits`. A non-admin user could therefore ask the model to create automations indefinitely, ignoring `AUTOMATION_MAX_COUNT`, and could schedule them below `AUTOMATION_MIN_INTERVAL`, on both create and update.

Both tools now call the same `check_automation_limits` helper the routers use, so the limits and the admin bypass cannot drift between the chat path and the HTTP path. A rejection is returned to the model as a plain error message instead of raising. `update_automation` also gained the missing user lookup guard, since the helper needs the user's role.

The `automations.enable` toggle and the `features.automations` user permission were already enforced when the tool set is assembled, so they are unaffected.

Fixes #27121
2026-07-26 17:55:56 -04:00
Timothy Jaeryang Baek c55e373b99 refac 2026-07-16 00:58:34 -04:00
Timothy Jaeryang Baek b23ddeb280 refac 2026-07-16 00:30:44 -04:00
Timothy Jaeryang Baek ee000c503c refac 2026-07-15 23:21:06 -04:00