[PR #4724] [MERGED] feat: Add __tools__ optional param for function pipes #108861

Closed
opened 2026-05-18 08:00:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/4724
Author: @michaelpoluektov
Created: 8/19/2024
Status: Merged
Merged: 8/20/2024
Merged by: @tjbck

Base: devHead: tools-refac-2.1


📝 Commits (10+)

📊 Changes

6 files changed (+249 additions, -133 deletions)

View changed files

📝 backend/apps/ollama/main.py (+2 -5)
📝 backend/apps/webui/main.py (+19 -11)
📝 backend/config.py (+0 -1)
📝 backend/main.py (+38 -115)
backend/utils/schemas.py (+104 -0)
📝 backend/utils/tools.py (+86 -1)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests for validating the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To cleary categorize this pull request, prefix the pull request title, using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

  • Add optional __tools__ param to function pipes.

Added

  • Function pipes accept optional __tools__: dict[str, dict] param for tool calling.

The __tools__ dict maps tool names to a dict with keys "toolkit_id", "callable", "spec", pydantic_model, "file_handler" and "citation" where "file_handler" and "citation" are booleans for whether or not the tool handles files and has a citation object (mostly useful for the tool prepending thing) and "spec" is an OpenAI compatible "function" spec for the tool.

Testing

Tested with Ollama, OpenAI and an OpenAI proxy function, with the flags enabled and disabled.


🔄 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/open-webui/pull/4724 **Author:** [@michaelpoluektov](https://github.com/michaelpoluektov) **Created:** 8/19/2024 **Status:** ✅ Merged **Merged:** 8/20/2024 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `tools-refac-2.1` --- ### 📝 Commits (10+) - [`3164354`](https://github.com/open-webui/open-webui/commit/3164354c0b86517a2e168ac50f44c4abe1d319d8) refactor into single wrapper - [`32874a8`](https://github.com/open-webui/open-webui/commit/32874a816d894dc8d012eee24ce96887d6851d5d) add filter toggle envvars - [`ce7a1a7`](https://github.com/open-webui/open-webui/commit/ce7a1a73ac4a5554b251e2970145879326d445f9) remove more nesting - [`fd422d2`](https://github.com/open-webui/open-webui/commit/fd422d2e3c0340cd0dd02da46e3071e4e96e6bde) use filters envvars - [`a4a7d67`](https://github.com/open-webui/open-webui/commit/a4a7d678f9908e0466e3395ff437824e7fe88ee3) move tools utils to utils.tools - [`18965dc`](https://github.com/open-webui/open-webui/commit/18965dcdacfc793fc6eeaa72b56b035f38785ba8) delete keys if envvars are set - [`13c03bf`](https://github.com/open-webui/open-webui/commit/13c03bfd7d5a69ae8f00ce370d47158b55cd13e4) add __tools__ custom param - [`a933319`](https://github.com/open-webui/open-webui/commit/a933319adb28b556cdd085ca98eaecce74343130) import error? - [`528df12`](https://github.com/open-webui/open-webui/commit/528df12bf1c227cbd69e8416468ffcb047152d95) fix: nonetype error - [`5edc211`](https://github.com/open-webui/open-webui/commit/5edc211392ebff06ac3687021f5ea6c04d75e065) pass docstring to function ### 📊 Changes **6 files changed** (+249 additions, -133 deletions) <details> <summary>View changed files</summary> 📝 `backend/apps/ollama/main.py` (+2 -5) 📝 `backend/apps/webui/main.py` (+19 -11) 📝 `backend/config.py` (+0 -1) 📝 `backend/main.py` (+38 -115) ➕ `backend/utils/schemas.py` (+104 -0) 📝 `backend/utils/tools.py` (+86 -1) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests for validating the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title, using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description - Add optional `__tools__` param to function pipes. ### Added - Function pipes accept optional `__tools__: dict[str, dict]` param for tool calling. The `__tools__` dict maps tool names to a dict with keys `"toolkit_id"`, `"callable"`, `"spec"`, `pydantic_model`, `"file_handler"` and `"citation"` where `"file_handler"` and `"citation"` are booleans for whether or not the tool handles files and has a citation object (mostly useful for the tool prepending thing) and `"spec"` is an OpenAI compatible "function" spec for the tool. # Testing Tested with Ollama, OpenAI and an OpenAI proxy function, with the flags enabled and disabled. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-18 08:00:51 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#108861