[PR #1402] [MERGED] docs: correct the tool development and valves pages against tools.py, plugin.py and the valves renderer #1367

Closed
opened 2026-10-18 14:19:11 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/docs/pull/1402
Author: @silentoplayz
Created: 9/18/2026
Status: ✅ Merged
Merged: 9/18/2026
Merged by: @Classic298

Base: main ← Head: docs/tools-development


📝 Commits (1)

  • 0aa4c33 docs: correct the tool development and valves pages against tools.py, plugin.py and the valves renderer

📊 Changes

2 files changed (+21 additions, -5 deletions)

View changed files

📝 docs/features/extensibility/plugin/development/valves.mdx (+3 -1)
📝 docs/features/extensibility/plugin/tools/development.mdx (+18 -4)

📄 Description

Summary

I compared the tool development and Valves pages with utils/tools.py, utils/plugin.py, utils/middleware.py and the Valves renderer on dev.

  • The page said pip runs in the same process and freezes the UI during a requirements install. It runs as a child process on a worker thread, so only the save that triggered it waits.
  • __model__ for a workspace tool is the task model when one is configured, not the chat model. The entry says so and points at __metadata__["model"].
  • Two loading rules were missing: every public callable on the class is exposed as a tool, so helpers need a leading underscore, and __init__ must set self.valves or stored admin valves are never applied.
  • Added what an un-hinted parameter becomes in the schema, that __ parameters are stripped from it, and what each return type (string, dict, list, image data URI) turns into for the model.
  • Added __id__, __chat_id__, __message_id__ and __request__ to the reserved arguments, the file_handler flag and the fact that only the Legacy path reads it, and the import-prefix rewrite that breaks from configparser import ....
  • Valves page: the renderer picks a control by a fixed order, so password and select only apply to str fields, and a dynamic-options method must be synchronous and return a list.

None.

Checklist

  • I have reviewed the relevant documentation and matched the existing style.
  • This PR meets Open WebUI's contribution standards: it is accurate, relevant to users, narrowly scoped, maintainable, and not promotional content, advertising, lead generation, SEO placement, or a request to list a product, service, provider, integration, gateway, tool, or company primarily for visibility.
  • I understand that PRs that do not meet these standards may be closed without review and will not be merged. Repeated, low-quality, off-topic, promotional, or intentionally misleading submissions may result in the contributor being blocked from future participation in Open WebUI repositories.

Notes for reviewers

Sources on dev: plugin.py (asyncio.to_thread around the pip subprocess, the four import replacements, resolve_valves_schema_options), tools.py (get_functions_from_tool, valves loading, spec stripping of __ names, get_task_model_id feeding __model__), middleware.py (tool result handling and file_handler), and the branch order in src/lib/components/common/Valves.svelte.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/docs/pull/1402 **Author:** [@silentoplayz](https://github.com/silentoplayz) **Created:** 9/18/2026 **Status:** ✅ Merged **Merged:** 9/18/2026 **Merged by:** [@Classic298](https://github.com/Classic298) **Base:** `main` ← **Head:** `docs/tools-development` --- ### 📝 Commits (1) - [`0aa4c33`](https://github.com/open-webui/docs/commit/0aa4c337877b01c54a0c9bd3a8ed76d38b559f93) docs: correct the tool development and valves pages against tools.py, plugin.py and the valves renderer ### 📊 Changes **2 files changed** (+21 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `docs/features/extensibility/plugin/development/valves.mdx` (+3 -1) 📝 `docs/features/extensibility/plugin/tools/development.mdx` (+18 -4) </details> ### 📄 Description ## Summary I compared the tool development and Valves pages with `utils/tools.py`, `utils/plugin.py`, `utils/middleware.py` and the Valves renderer on `dev`. - The page said pip runs in the same process and freezes the UI during a requirements install. It runs as a child process on a worker thread, so only the save that triggered it waits. - `__model__` for a workspace tool is the task model when one is configured, not the chat model. The entry says so and points at `__metadata__["model"]`. - Two loading rules were missing: every public callable on the class is exposed as a tool, so helpers need a leading underscore, and `__init__` must set `self.valves` or stored admin valves are never applied. - Added what an un-hinted parameter becomes in the schema, that `__` parameters are stripped from it, and what each return type (string, dict, list, image data URI) turns into for the model. - Added `__id__`, `__chat_id__`, `__message_id__` and `__request__` to the reserved arguments, the `file_handler` flag and the fact that only the Legacy path reads it, and the import-prefix rewrite that breaks `from configparser import ...`. - Valves page: the renderer picks a control by a fixed order, so `password` and `select` only apply to `str` fields, and a dynamic-options method must be synchronous and return a list. ## Related issue or discussion None. ## Checklist - [x] I have reviewed the relevant documentation and matched the existing style. - [x] This PR meets Open WebUI's contribution standards: it is accurate, relevant to users, narrowly scoped, maintainable, and not promotional content, advertising, lead generation, SEO placement, or a request to list a product, service, provider, integration, gateway, tool, or company primarily for visibility. - [x] I understand that PRs that do not meet these standards may be closed without review and will not be merged. Repeated, low-quality, off-topic, promotional, or intentionally misleading submissions may result in the contributor being blocked from future participation in Open WebUI repositories. ## Notes for reviewers Sources on `dev`: `plugin.py` (`asyncio.to_thread` around the pip subprocess, the four import replacements, `resolve_valves_schema_options`), `tools.py` (`get_functions_from_tool`, valves loading, spec stripping of `__` names, `get_task_model_id` feeding `__model__`), `middleware.py` (tool result handling and `file_handler`), and the branch order in `src/lib/components/common/Valves.svelte`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-18 14:19:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
open-webui/docs#1367
No description provided.